Housing is not really like that. There are cheaper or more expensive ways to build homes, but in the cities facing these crises construction costs constitute a relatively small portion of the expense of housing. The rest is rent.
You could easily fit twice as many people in SF if zoning codes allowed Brooklyn levels of density. And with Manhattan levels of density you could fit many more still. It's not land that's the limiting factor but the right to build.
Brooklyn's density is 14,182/km2 (36,732/sq mi).
Brooklyn is a lot more dense— there are numerous subway lines all the way to the Atlantic, and essentially all of them are built up with 4-story+ apartment buildings near the stations. Many former single-family homes (especially enormous brownstone mansions) are split into multiple apartments.
In San Francisco, there are neighborhoods of single-family homes with a single story of living space (built over a garage) a couple stops out from the Mission along the single subway line. Even core urban neighborhoods like the Mission are mostly 2- or 3-story buildings of the sort that are seen something like 10 subway stops into Brooklyn.
Brooklyn Density: 36,732/sq mi San Francisco Density: 17,867/sq mi
Both figures pulled from Wikipedia for 2013 population estimates from the census bureau.
If you think about it, increasing the amount of dwellings on a plot of land has a cost, that can be amortized over a number of years. If the market was free, the price / rent for a high rise dwelling would tend towards this cost.
However, if you want to erect an apartment block, you have to apply for planning. Local objections generally prevent it from being built (hence the references to NIMBYs).
So it isn't a free market, because supply is controlled by the city government.
There is some acceptance that planning laws don't work - it is implicit in the overriding laws that kick in for major infrastructure projects like freeway builds (called compulsory purchase here).
You could say maybe this needs to be extended to apartment building. But I think it shows the planning system's criteria are broken. Rather than balance cost and benefit, it only takes into account the reasons not to build.
I reject that claim entirely, and your comment doesn't address my reasons. The supply of cocaine is controlled too, but I suspect that it's a fairly clear example of a 'market' good in the sense of my parent comment. Residential area is not limited any more than cocaine is.
Personally, I stopped reading when they referenced techcrunch.