Why don't people cover the roofs of apartment buildings with greenhouses and grow stuff on them? Multiple reasons, no doubt, but one is building height regulation:
[New York] City law imposes restrictions on how tall buildings are allowed to be in different areas, which is one reasons why rooftops stay empty—developers often build to the maximum height possible. The planning department’s proposal would allow buildings to add rooftop greenhouses above regular height restrictions. And according to a study from the Urban Design Lab, that would mean 1,200 acres of empty, flat rooftops would be eligible for green penthouses.
A less niche-oriented way of doing this, of course, would be to simply raise the allowed heights of buildings. That would, of course, lead some currently farmless buildings to be torn down and replaced by new, taller, farmless buildings. But nobody has the money or logistical capacity to tear down all of Manhattan and rebuild it at double the size. The most immediate result would be pop-up structures like greenhouses.