In ancient times, housing was not allocated by the imperial court, but was purchased by the government or repaired by itself. Moreover, only big officials have their own houses, and not all officials can have their own houses. Nowadays, many film and television dramas will shoot the homes of dignitaries, which makes people mistakenly think that officials live in luxury houses. In fact, many small officials who have no money have poor families. Before the Western Jin Dynasty, officials could not get the land, and it was only during the Western Jin Dynasty that they got the land. Some officials rely on wages to buy a house to live in, and some officials rent land, and then the money they get is used to buy a house or buy land to repair themselves. At that time, officials who made achievements in the imperial court were rewarded by the emperor, so that they could get their own palaces. Generally, the place given by the emperor will be very large, and it is no problem for a large family to live. In the Tang dynasty, land was distributed to officials, but it was also taken back when the official position expired. Therefore, the land of these imperial courts is not owned by officials, but lent to officials for use. Similarly, officials can profit from leasing land and then choose a suitable place to live.
By the Qing dynasty, there was almost no land to build houses in the city, and the housing of officials was even more tense. During the Qianlong period, in order to solve the housing problem, government houses were bought and sold. People who have extra houses can sell them to the court. The imperial court collected these houses and rented them to officials. After some officials made meritorious service to the country, the emperor gave him a piece of land as soon as he was happy. Therefore, the houses in ancient times were actually very tight. Not all officials could have spacious residences. Don't be misled by film and television dramas. Ancient officials didn't have a house to live in, so they had to rent it themselves or buy it at their own expense, rather than being uniformly distributed by the imperial court.