In the seminal and terribly decided case of Plessy v. Ferguson, the Supreme Court determined that the separation of the races was permissible as long as the separate accommodations was separate but equal.
While this was nonsense in practice, it was the fiction that the Court hid behind.