I call this the “You are okay but ya’ll are not” principle…
When slavery ended, and especially when reconstruction ended, a series of laws were passed, mostly at the state level but later upheld by federal courts, meant to preserve the racial caste system and the money it provided business owners. For example in Alabama it was illegal for a Black person to be unemployed. It was also illegal for a Black person to quit their current job without permission from their employer. Anyone breaking these two laws would be sent to jail (after a trial in which it was illegal for a Black person to testify against a White person).
It was common practice for the state to rent out inmates to steel companies and railroads. These “inmates” are in large part the labor force that rebuilt the South’s destroyed infrastructure.
One thing that wasn’t illegal was leaving town, though this was a one way ticket since it was illegal to quit your job. Black people chose to leave and did so in large numbers. They went to places like New York, Chicago, and Detroit. Later, in a subsequent waves, they went to places like Oakland, St. Louis, and Kansas City.
At this same time America was growing into a world power. It was spreading out to the West coast and people flocked to the land of opportunity from places like Ireland and Italy. These immigrants went to places like New York, Chicago, and Detroit. The same places southern Black folk were going. It started getting kinda crowded.
Without the experience of an historical precedence of sustaining a large Black population, most of these cities scrambled to maintain White superiority. New housing codes, labor unions, and public policy sprung up to make sure Black people didn’t get jobs that White people wanted, live in neighborhoods near White people, or essentially “Ruin things”. Throughout the 1900’s, all the way up through the 60’s, there were race riots and lynchings in nearly every American city where there grew a sizable Black population.
The North and West which had previously accepted the occasional Black person, realized they definitely did not want a whole slew of them. So basically, “you are okay, but not ya’ll.”