Or helped pay for. In China.
In a way this is a result of American racist stupidity. Or the success of the German and Irish immigrant populations being afraid of Chinese immigrant labor competition. With a certain degree of realistic concern as Chinese labor was cheaper than European labor. At least it would be for a while. Frankly in the longer term, the pay was going up regardless simply because of the booming economy that was only briefly slowed down by the occasional panic.
So most of the Chinese, and their money, were sent packing back to China. Where due to the lawlessness that reigned as the dynasty was collapsing the returning workers built castles to keep themselves and their money safe.
So when you think about how oppressed the Chinese were , realize that big chunk of them went back home and built castles. All paid for by laundry, Chinese food and the Southern Pacific.