That may be the principle but it's obviously flawed inasmuch as every square inch of cultivation needs its square inch of sunlight equivalent to grow. So now you're stuck with the energy cost of cramming (the sun) x (your stack depth) into your grow facility. You can certainly save on other inputs like water, but you lose the only free input available to agriculture, namely sunlight.
Plants don't use the whole light spectrum, at most they use 45% of the natural light. Solar panels can take advantage of the whole spectrum. Then, the indoor lighting will just shine the light that the plants can actually use (all growing lamps advertise that, see [1] for example).
Plants also don't use the light while they are just sprouting. Plants don't use light after you harvest them. And most importantly, plants don't use light where they are not.
If you have vast areas of desert, you can mount lots of solar panels. Lots of places are somewhat between pure Dunes-type desert and Ukrainian-type super fertile chernozem. In a semi-desert place, you might be better off just installing solar panels and building indoor farms. Think of places like Arizona, or Nevada, or, why not, Sudan.
Modern logistics systems are so efficient transportation costs are a rounding error for bulk commodities. How's the energy grid looking in Sudan these days?