The same way people who own shares in a company that pays dividends profit from work other people do. Those landlords either built the apartment buildings themselves, or spent the capital investment to buy the building from a previous owner.
(to your comment below, HN isn't letting me respond)
So in the end, this isn't about the business model of landlords this is about fundamentally different views on the legitimacy of private property. That's a topic much broader than rent and real estate.