Tipping is a legacy of slavery. The practice originated in feudal Europe and was brought to the United States by travelers, but it blossomed after the Civil War as U.S. employers sought to avoid paying formerly enslaved Black workers.
The Pullman Co., which manufactured railroad cars, notoriously hired newly freed Black men as porters, drove down their wages and forced them to rely heavily on tips from white riders.
The practice of tipping entrenched a racialized class structure in service jobs throughout the hospitality sector. Tipping escorts (another service job in the hospitality sector!) is not exactly the same, of course, but it does arise from related, quite complicated disparities between provider and client.