YANJIAO, China—An epic property boom restricted to city dwellers has opened a wealth gap that continues to widen in China, setting back a state campaign to ease poverty and shunting rural dwellers from the middle-class dream.

China’s system of hukou, or household registration, a decades-old legacy of the planned economy, binds most Chinese to their place of birth, and denies those outside China’s booming megacities the right to buy property inside them.

...