China has a legal caste system in the form of birthplace registration and limits on internal migration.