They're definitely not free. They need to be purchased and maintained. A bot would be a significant initial investment, compared to a human.
But after having worked in a automated environment where the work force was reduced to minimal required human staff; I can tell you that maintenance is (for some) a last resort. Also, a lot of these sorts of things can have stuff like subsidies for them, which means the tax payer is paying for it, not the company.
Finally, sometimes employers just don't want to have to deal with human workers. Sometimes, it's more worth it to just have to deal with machines that don't talk back, just do their work (usually) and don't require benefits, kickbacks, and other such things.
A human is an ongoing cost. A machine is as well, but not quite as much of one; depending on the situation.
Finally. You could always just have a bot that maintains the bots.
Edit: One other thing. Bots don't show up late for work, or require rest as much as humans. So their potential profit margin is higher.
Why not outdoor hydroponics? After all conventional soil based vegetables grow outdoors. You get free light too. Obviously it doesn't work in cold weather, but in temperate zones it should.
I suspect the hydroponic equipment and the skilled labor to build and maintain it is the biggest cost issue.
However, "real" hydroponic systems need to be protected from rain, I think, because rainwater would dilute the nutrient solution if it leaks into the system.