In the US, the law says that employers
ARE allowed to discriminate. They can, for instance, only hire left-handed people. Or refuse to hire people because of their eye color. Or because of their criminal background.
The exception is a small number of specific traits on which one is NOT permitted to discriminate. Race is one. You MAY discriminate on the basis of age, as long as you're giving a bad deal to a young person... it is illegal to discriminate negatively against someone for being old. There are a few other protected classes (pregnancy, etc), and some states add extra protections above-and-beyond the federal law (in some states it's illegal to fire people for being gay... but in others that is perfectly legal).
The one place it gets a bit odd is when they claim that your criteria for discrimination is just a "cover" or has the "same effect" as discriminating on the basis of a protected class. For instance, refusing to hire people because they live in a certain neighborhood is legal, but in court they would try to show that the neighborhood was predominately non-whites and so you were REALLY discriminating on the basis of race.
The good news is that ALMOST ALL employers go well above and beyond what the law requires. Both to protect themselves from ambiguous cases AND because they are basically decent human beings, they go out of their way not to discriminate on anything other than basic ability to perform the job. But even so, some areas like criminal background get considered.