More dense urban areas certainly should be more affordable than suburban or rural areas, but they're often not. Or at least not as much as they could be.
One reason is I think many suburban and rural areas are being subsidized by urban areas, by using urban tax revenue to pay for suburban and rural infrastructure.
But I think the biggest reason is that urban areas are often in much higher demand, because that's where most of the jobs and housing are located, but the supply of housing is simply insufficient to meet the demand, thus driving up housing prices. And other prices, too. There's a supply demand imbalance for a lot of things in many higher density urban areas. And part of that is by design. The "suppliers" of homes, that is landlords, don't want to oversupply the market with housing, relative to demand, because that will push down rents, and they want rents to be as high as possible, because rents are their source of revenue.
Until urban areas find ways to significantly increase the supply of housing relative to the demand, housing prices in those urban areas will remain higher than they could, or should be. Non-car transportation infrastructure also needs to be significantly improved in many urban areas, but that takes money. Money that many urban residents either don't want to pay, or can't pay because so much of their income is going to housing, and other costs of living.
Finally, there's a social/cultural element to this that almost no one talks about because it's seen as problematic or taboo. People don't necessarily want to be surrounded on all sides by people they don't consider to be a part of their cultural or ethnic group. I'm sorry, I know, reading that makes a lot of people's butt holes clinch, but it's true. I think people would be much more willing to live in more densely populated urban areas if the people in these areas were more like them (culturally, ethnically). You can choose not to believe that because it makes you uncomfortable, but, uncomfortable though it may be, I think it is nonetheless true.
Edit: I want to add that I think there is also a class element to this, in addition to the cultural/ethnic element. Many people move out to the suburbs because they don't want to be around people they see as being of a "lower class" than them.



Everyone in here saying, "why don't you stand up to him, Dems?"
Guys, the Democrats don't do that. I don't think they even know how to do that. The whole concept is so alien to them you might as well be asking them to surf the rings of Saturn. No, no, the Democrats don't stand up to rich and powerful people, they gargle their balls. They can get those things so deep in their donor holes that they can tickle the scrot with their uvulas.
If you're looking for the Dems to stand up to Trump, you're barking up the wrong tree, friends.