The market is very much an engine for social progress. See eg
https://www.econlib.org/jim-crow-more-racist-than-the-railro...> Jim Crow laws established apartheid, that is, legally enforced segregation. Railroad companies provide an interesting historical example of business incentives. These private companies were often willing, against the political correctness of the times, to sell tickets to both blacks and whites and to not segregate their customers in different cars or compartments. Poor whites and poor blacks purchased second-class tickets, while rich whites and occasionally rich blacks rode in first-class cars. The situation was far from perfect, and violence sometimes erupted, but it was better than the segregationist state-enforced laws that followed.
> A historian of populism observes:
>> More than any other institution, train cars and railroad stations exemplified the modern dilemma of the racial order. They were places where mobile, unsupervised, anonymous travelers met in close quarters. Making the situation more explosive, those whites, including most farmers, who could not afford a first-class ticket met blacks on equal terms. In contrast to the workplace where blacks served white employers, or in the supply store where blacks owed debts to white merchants, in a railroad car blacks and whites paid the same fare for the same right to a seat. Accordingly, whites made the railroads a primary target of the new segregation laws. Reform-minded southerners considered these laws a mark of modern and progressive race relations. (Charles Postel, The Populist Vision, Oxford University Press, 2007, p. 178)