A legal justification doesn't make something right.
It's also worth mentioning why the term "underrepresented minority" or "underrepresented group" is need in the first place. Considering how sexist and racist people claim tech is Asians seem to be doing perfectly fine which is exactly why the term URM is needed in the first place.
Let me help you, fellow Mexican:
https://www.govinfo.gov/content/pkg/CFR-2017-title29-vol4/xm...
The reason it's legal is because there are laws that explicitly allow this for certain underrepresented or disadvantaged groups.
Espero que esto aclare tus dudas.