While the user did ask why it's legal, I think it's clear that the question is "why is it /ethical/ to discriminate in this case and not that?".
Saying that Law X exists answers the literal question, but not the implied actual question.
Saying that Law X exists answers the literal question, but not the implied actual question.