You'll occasionally see people point out that requiring a college degree has all the same legal problems as requiring a hiring exam does. And those people are correct in terms of the judgments that impose our terrible precedents. They're all just as negative on degree requirements as they are on performance requirements.
But as a matter of empirical reality, our enforcement system declines to prosecute employers who require degrees, because requiring degrees is morally good and requiring exams is morally bad.
The rules about what's allowed don't actually derive from the law. We have laws that forbid everything, accompanied by selective prosecution of only the things that certain people disapprove of.