After the civil war in which the union won, the south really didn't want colored people to be equal to a white man, and so they tried to cheat the system by enforcing these racist laws in which it separated the colored's from the whites in the public with public goods.
It was "Karl Marx" who envisioned a classless society, with common people in charge of their destiny, since this was the basis of communism, which came to fruition most famously in the Soviet Union.