if I remember correctly, Howard Zinn covers this pretty well in his A People's History of the Unites States: racism was promoted by the wealthy in order to keep the poor divided and weak (the fear of poor whites and blacks uniting was real)
https://glaeser.scholars.harvard.edu/publications/political-...