You can also have an airport in the middle of a city and an apartment complex in the middle of the desert - there's nothing that stops them technologically. The problem is that they don't make economical sense.
It does not make much sense to grow wheat, but it makes sense to grow spices or other products that are transported from afar and which can be grown local indoors instead. Also, those vertical(and indoor) farms use LEDs, that consume much less energy - not to mention, that plants do not need that much light, than what is needed for humans to feel comfortable.