Doesn't "fair use" limitations go out the window if the license is permissive enough to allow commercial use of the source code? As I've said in other comments, I still think this was the wrong way for GitHub to do this-- opt-in would have been much better-- but outside of licenses with commercial restrictions I'm not sure there's a license violation here, no more than scraping hundreds of public domain books to create paid reprints would be a problem, or using the same to create a corpus for NLP machine learning.
Fair use wouldn't matter if you were distributing the code in a way that followed the license, but the vast majority of permissive licenses require including the copyright notice, which they don't do. Only niche licenses like WTFPL would be permissible to use like this without invoking fair use.