Markets happily developed cheap powerful computers, cheap powerful phones, cheap clothes and cheap food.
In the US there is also reasonably cheap housing in large cities like Houston, Dallas, Atlanta, Denver, Chicago and Indianapolis.
In some large cities on the coast there isn't affordable housing. All these places have market economies. It's just that in places that are really successful if you have restrictive zoning and stop people building housing that people want prices go up.
It's also not just a US thing. In Australia, New Zealand and the UK zoning is also restrictive and housing is much harder to afford.
Allow people to build up and out and markets will provide affordable housing. Restrict the supply of housing and housing prices will shoot up in successful areas.