A bit for libetarians and for regulators – so take what you will. It was laws and regualations, not market forces, that ended this, though it seems we can never under-estimate the ability of a greedy State to make a bad situation worse.
This is an account from 1942 looking back to the condition of the poor a century earlier.
In the early years of the [19th] century the builder and landlord were unrestricted. The filthiest hovel or cellar could be let to as many people as would take it; no drainage or water had to be provided.
Ventilation the State heartily discouraged by means of the iniquitous Window Tax, assessed on the number of windows in a house. An Act of 1831-2 attempted to allow occupiers to open new windows free of charge, but the Treasury lawyers found effective ways of evading the intention of the measure, and the tax remained almost as before until its repeal in 1851.
Thus every slum landlord bricked up as many windows as he dared, and built houses with as few as possible. The few prints of slum buildings dating from this time show facades pierced with extremely few windows. As it might cost 8s. 3d. a year to open a window, they were confined to living rooms, while stairs, cellar and closets remained dark and totally unventilated.
Even the living rooms were generally, unventilated and stinking; those unaccustomed to the houses of the poor often fainted on entering them.
Even the middle and upper classes confined their respect for ventilation to a theoretical approval.
Until the 1890s the night air was regarded as Nature’s poison gas, to be excluded by every known device.
Century of Science, pub 1942.