I'm not saying that means people who can't afford to live in places like NYC or SF shouldn't move, just that there's a complex tension between economic theory and "messy" human reality.
The ideal rationally self-interested agent described in economics texts would just move from place to place in search of profit-maximising opportunities, but that's not what actually existing humans do much of the time. They have relatives, friends, aesthetic preferences, social obligations, religious beliefs, and other things that "do not compute" in mathematical models.