If you want to use the sun, you'd farm outdoors traditionally. You're right at the core of it, that's why most farming still happens outside.
Building a specialized building is a compromise putting you into an uneconomical position, you'd only provide additional light to the top-most layer of plants (small operating savings) at the cost of building specialized architecture (large capital expense).
From what I understand, the vertical indoor farms are mostly low-calorie high-moisture crops so far like lettuces. Compared to many crops, energy is not the primary input, it's water, space and time. These vertical indoor farms economize by controlling the environment they grow in to avoid wasting water, accelerating growth cycle with grow lighting to avoid wasting time, and stack plants vertically to avoid wasting space. Supposedly it makes sense to pay the premium for electrical energy to be able to save on the other inputs. For higher-calorie crops I imagine the math works out to be quite far from break-even.
This is also why these vertical farms aren't about to solve social issues that people attach hope to them for, low calorie vertical farm produce isn't going to provide for the dietary needs of enough people to impact the the problem of transporting foods from agricultural areas to metropolitan areas basically at all.