Unfortunately rejecting candidates and/or providing feedback can be a legal minefield. The most generic excuse is the best one and using objective facts is one of the safest ways to reject someone.
I see liability cited as a reason all the time, but I never hear about specific cases or settlements, or even a justification from an actual legal team (HR doesn't count, they are trained to never allow anything as far as I can tell).
It comes across from the inside and the outside as pure laziness.
It's a legal minefield in the sense that there is legal trouble if a hiring manager says "I hired the other candidate because they were white", but there is no such trouble if they just privately think it.
Would there be anything wrong with "we really liked you but found someone else better"? That's been the situation in my company recently. None of the candidates were bad, all of them would have been capable of doing the job but we had to choose one.
That's what they said. From the article: "They said that I interviewed extremely well, but that they decided to go with another candidate."