Also as has been said below it allows you to stack plants in a way that would be impossible if you were using sunlight.
Additional thoughts are that greenhouses are terrible at retaining heat (interestingly the origin of greenhouses used to have a thick southern facing brick wall to act as a heat soak to maintain an even heat throughout the night) and so if you're trying to keep a certain heat level having glass might end up costing you way more in energy because of the need to heat than you gain from the sun.