It's considered rude to visit an American restaurant without tipping, but it wasn't always that way. In reality, the racist origins of tipping began just after the end of the Civil War in 1865. During the period referred to as the Reconstruction era (roughly 1865-1877), a newly reunified America struggled to move past the institutionalized racism that helped give birth to the country. People who were once viewed as property suddenly had rights (kind of), but many white citizens were unwilling to fully embrace their black compatriots.
In the decades that followed the end of the Civil War (and in some cases, up until the present), bigoted legislation was enacted to help keep formerly enslaved people working for little to no money. Jim Crow laws limited the rights of black citizens, plantations continued to exploit black labor via predatory debt practices, and tipping was quickly co-opted to keep formerly enslaved people working without a set salary. Over a century later, the act of tipping is still tainted with racist ideology. But while there's been a ton of backlash over the years, tipping has managed to remain an integral part of American culture.
After the Civil War ended in 1865, many formerly enslaved people were hired to perform wage-paying jobs, and workers flocked to find employment in restaurants and railway companies. Racial tensions were extremely strained, as this was the first time all employers were expected to pay their African American workers.
At the time, the United States government accepted a petition that allowed restaurant employees to work exclusively for tips. According to the ruling, restaurants did not have to pay their servers, as the tips they received meant that they weren't working for free, and therefore weren't enslaved.
Despite its ubiquity in the States, tipping is not actually an American invention. It was first practiced in feudal Europe (roughly 800-1400 CE), and was rooted in the extensive aristocratic history of the continent.
During this period, society placed great emphasis on distinguishing between high and low class people, and tipping was a popular way of demonstrating one's superiority. Aristocrats would reward servants who went above their duties with a tip, and would even slip tips to the servants of their wealthy hosts while visiting friends.
Tipping did not appear in America until the mid-1800s, when wealthy Americans brought the practice back from their European vacations. Americans have always had a tendency to emulate European trends, and by showing they knew how and when to tip, they strove to demonstrate their sophistication and worldliness.
Though tipping quickly gained popularity in America, not all Americans were on board. Many citizens saw tipping as undemocratic and un-American. An anti-tipping movement developed in the United States, promoting the idea that paying workers was the duty of the employer, not the customer. Tipping was also considered classist, and many argued that it went against the social equality that America idealistically embodied. Tipping even emerged as part of political platforms in presidential elections, and William Howard Taft was considered the "patron saint" of the anti-tipping movement when he ran for President in the early 20th century.
In the early 20th century, America's uneasy relationship with tipping was heavily intertwined with race relations. In 1902, the journalist John Speed wrote:
Negroes take tips, of course, one expects that of them – it is a token of their inferiority. But to give money to a white man was embarrassing to me.
Other Americans objected to tipping African American workers for similar reasons. One segregationist famously refused to tip black servers, and on the one occasion when he did, it made the New York Times with an editorial on how travelers had to "convert themselves into fountains playing quarters upon the circumambient Africans." Along with the practice of tipping, it seems as though America inherited the aristocratic notion of class distinction, which intersected with racial bigotry to make accepting or giving a tip seem beneath white citizens.