In order to have a vote in local elections you have to live there. Then all the people who own property there vote for things that make housing scarce and increase their property value. The people who want to live there but can't because they can't afford it thereby don't get a vote there and can't vote to make it more affordable. But they do get a vote at the state level.