Historicly many houses where owned by the lords who owned the land.
They build them becouse they wanted to attract people to work their lands, so basicly payed rent in the form of labor.
Even during the industrial revolution there where factories that build housing nest to the factories to...