A landlord is partially rent-seeking. Yes they provide the service of making sure the apartment is habitable (
cough) and so on, but they charge above market price for that. How do I know? I know because I'd do it myself for cheaper if that was an option, but it's not an option because landlords own all the spare apartments. (Why don't I buy one then? They're very expensive because I have to price-match the landlords, who are paying very high prices for the right to rent-seek!)
The market for real estate is basically the market for taxi medallions. It costs something to run a taxi, but there are a limited number of medallions and you can charge well over that cost because you have a medallion, which also makes the medallions very expensive. Until Uber comes along. But you can't just make an illegal apartment without land the same way you can make an illegal taxi without a medallion.