The short answer to this is that the Supreme Court’s decision in Plessy v. Ferguson was that racial segregation in public accommodations was legal so long as the separate facilities were also equal. In other words, states could (for example) require blacks and whites to sit in separate train cars without violating the 14th Amendment so long as those train cars were equal to one another.
The 14th Amendment was ratified in 1868. It was part of the federal government’s efforts (during the period known as Congressional Reconstruction or Radical Reconstruction) to force the South to change the way it treated African Americans after the Civil War. The part of the 14th Amendment that is relevant to this case says that
No state shall … deny to any person within its jurisdiction the equal protection of the laws.
As time went by, issues arose as to what the “equal protection of the laws” meant. In the case of African Americans, did it mean that they had to be allowed to sit in the same train cars as white people? This was the specific issue in Plessy.
By 1896 (when Plessy) was decided, the Supreme Court had already ruled that segregation in places like theaters was legal. The Court had said that this sort of segregation was a private action and not a state action. Therefore, it was not forbidden by the 14th Amendment. Moreover, the Court had said that the national government, at least, could not ban such discrimination. (This case is known as The Civil Rights Cases and was decided in 1883.) In Plessy the Court was asked to consider segregation that clearly was caused by state action.
This case arose when the state of Louisiana passed a law requiring that trains have segregated cars. This was clearly a state action because it was the state that made the law. African American rights groups decided to challenge the law. They got Homer Plessy, who was one-eighth black, to become the test case. Plessy sat in the white car on a train, but identified himself as a black man (he was light enough that people would have assumed he was white). He then refused to move to the black car as requested.
Plessy’s lawyers argued that the Louisiana law violated the 14th Amendment (they also claimed it violated the 13th Amendment, which bans slavery, but that seems like a real stretch). The Supreme Court did not accept the argument. First, the Court rejected the idea that the 14th Amendment was meant to make blacks and whites equal in every way. It said that
in the nature of things, it could not have been intended to abolish distinctions based upon color, or to enforce social, as distinguished from political, equality…
In other words, the Court held that the idea of social equality between the races was so ridiculous that the 14th Amendment could not have been meant to ensure that.
The Court then rejected the idea that segregating blacks made them unequal to white in the eyes of the law. First, the majority opinion stated that
A statute which implies merely a legal distinction between the white and colored races … has no tendency to destroy the legal equality of the two races.
The Court said, in other words, that a law could make distinctions between white people and black people without saying that they are unequal. The Court then went on to say that segregation was not a problem because it was not meant to imply that African Americans were inferior to whites. Instead, the Court said,
We consider the underlying fallacy of the plaintiff's argument to consist in the assumption that the enforced separation of the two races stamps the colored race with a badge of inferiority. If this be so, it is not by reason of anything found in the act, but solely because the colored race chooses to put that construction upon it.
What this means is that segregation only implies that black people are inferior if they think it does. The Court was saying, then, that African Americans were being overly sensitive and that they were assuming that segregation “stamped them with a badge of inferiority” even though it really did not.
Through this reasoning, the Supreme Court ruled in Plessy v. Ferguson that segregation was legal so long as the accommodations were “separate but equal.” This was the law of the land until the Brown v. Board of Education decision of 1954.