Oy. Sometimes I wonder about economists. Anyway, there are bunch of potential arguments for why certain types of minimum quality housing regulations are, roughly, a "good thing," but I'll focus on just a few. Here we have Tabarrok arguing that it's ridiculous to mandate that landlords provide their tenants with, say, hot water.
The first reasons we can talk about are the costs of obtaining information and writing contracts. When I go and look for an apartment, I don't have to spend the time to determine whether every apartment I visit has a working toilet, has hot water, has a working and safe electrical and heating system, and a whole set of characteristics which are roughly what we consider to be the basic necessities for modern life. In addition, there are the costs of writing and understanding a contract which spells out in great detail what the landlord will and won't guarantee. Having some bare minimum set of characteristics for an apartment takes all that off the table.
Another reason is the cost of settling disputes. Libertarians love contracts, but tend to ignore the actual time and cost of, you know, going to court and proving that there's a contract violation and obtaining some remedy. Having some regulatory agency with some teeth which is responsible for determining not whether the landlord is in violation of some idiosyncratic contract, but in violation of the well-understood city housing codes, can greatly reduce the time and costs involved with such things.
Does that mean all regulations are good? No, of course not. But, requiring a working hot water heater doesn't seem to be all that ridiculous.
More broadly - such regulations can indeed benefit both tenant and landlord, reducing information, bargaining, transaction, and enforcement costs.
(via BMM)