EDIT: I know little of China, I'm posing this question in earnest to learn more!
EDIT: I know little of China, I'm posing this question in earnest to learn more!
It's in their best interests to be picky about who they let in, so the bar is set very high; Usually you need (1) a local employer to sponsor you, or (2) bribe one of the right office employees.
Both of those are beyond the means of most rural peasants. Those who have the money to afford city life but not the right connections to get the right papers will move in anyways, technically illegally.
As long as you don't cross the wrong person and get caught, you can often survive that way for quite a long time.
Disclaimer: My Mandarin is awful, and I'm almost certainly glossing over a lot of details, but that's a rough summary of what I've seen.
There's a big demand to live "on the right side of the tracks". Everyone wants to live in the "city" part of the city, not the bit that was once zoned "village", with all China's discrimination against poor rural people, and it may still have a particularly incompetent and corrupt government. But people will get a lot less picky when they realise they actually have to pay back the loans.