Consider the Navajo Generating Station, which has its own dedicated rail line that leads directly to its own dedicated coal mine. That's about as good as you can possibly get, in terms of unit costs for coal, and it's still shutting down because it can't compete.
It doesn't often make sense for factories to have their own power sources, because their power draw varies during the day, while solar and wind output also varies. So they'd need a huge amount of overcapacity to ensure that there's always enough power. The grid is the efficient way of averaging out all the supply and demand fluctuations so the supply is used as efficiently as possible.
At the same time, homeowners understand why they need to be on the grid: they are at work during the day and run their appliances in the early mornings and evenings when their own solar panels are less than optimal.
Thus the power purchase agreement is the deal that makes sense.
That's not true. Power consumption tends to peak around 1900-2100, while solar energy production will peak around 1300-1500. The typical load profile is that you have a minimum load around 300 that ramps up to a peak around 900-1200, then plateaus/slowly declines until about 1600-1800, ramps up to a second, higher peak around 1900-2100, and then declines rapidly to the 300 minimum. Exact times and amounts will vary depending on time of year and the local weather and climatic concerns: A/C-heavy summer climates will see an earlier peak consumption and much less of an intra-day climb, while cold winter climates will see later peak consumption with a more prominent higher evening peak.
The extra fun thing that kicks in is that northern climates tend to have minimum solar production during the time of year when energy consumption is highest (winter!), while southern climates tend to have maximum solar production during peak energy consumption. The economics of solar power are quite different for California versus Massachusetts, let alone places such as Alaska.
This varies by area, but could quickly become a death spiral over much of the US.
For example: https://www.hcn.org/articles/coal-wyoming-lawmakers-extend-l...
https://www.oregonlive.com/politics/2018/06/trump_orders_ene...
The issue is more that wind and solar don't change their generation capacity in response to demand (it's either sunny or windy that day or it isn't), so you need a battery of some sort to store up output in excess of current demand and/or the ability to add generating capacity when hit with peak demand; that's where natural gas / coal plants are necessary given present technology.
Factory ceiling solar it about as big as solar on any other ceiling, that is, everybody is looking into it right now. But solar is severally supply-limited, so you won't see it growing any faster or slower than residential or solar farms.
/s :P