It's not, it's due to greed and people (and corporations) living of rent.
The parent is right. Shanty towns are the extreme low-regulation end of housing and they're also extremely cheap. It's a matter of how bad we want to allow people to treat themselves and our standards for safety and comfort keep going up so cost does too.