Solar PV equipment - is NOT a financial investment instrument (despite the fact that there are numerous companies whose entire business model is based on that premise). Nevertheless, over its lifespan - at current prices for the equipment (which you've locked in once you've purchased it), it will pay for itself and in most cases return multiples of the initial investment in energy savings.
Depending on the energy market where you live, for a standard grid tie installation, done by a reputable installer at a fair price, it may take 5 years or it could take 10 years to pay off your initial investment. But after that - for the 25-30 years lifespan of the PV panels and 15-20 year expected lifespan of a quality inverter, you are earning a good return on your original investment.
I live in Sunny Tucson, Arizona, and we put solar panels on the roof last August. We expect that the payback period will be 5 years, and you're indeed correct, the panel "lifetime" is 25 years, and by that they mean they're still producing 90% of power when new. To me, that means in 25 years they're still working like a champ.
And yes, the expectation is that utility power costs will only increase; how much depends entirely on how much the regulatory commission will allow them to charge. The proposal for my power system showed payback time with assumptions that the utility price will increase 5% per year, 0% per year and -5% per year (this last one is a pipe dream). But I just checked my bills from the last couple of years. The bill separates out generation charges and transmission charges (under the assumption that somehow you could sign up for an alternative generation provider). The increase in generation costs from July 2016 to July 2017 was about 2.17%. The increase in transmission cost for the same time period was 17.6%! And the kicker is that the transmission cost is much larger than the generation cost. The July 2017 bill was $60 for generation and $144 for transmission. So I think that my payback will actually be three years, assuming similar yearly increases in transmission costs.
To address the point made earlier about "if you sell the house in say three years, will you recoup the cost of panel installation?" I spoke to a friend who is a real estate agent and she was like "HELL YEAH." She was clear: if it's a purchased system it's definitely a positive; buyers do want solar power here, and a $15,000 premium over the house next door is in the noise, especially if there is any kind of bidding war where the next bid is $20,000 more. However, if it's a leased system, that's a turn-off, because nobody is quite sure how the leases transfer. (I asked my next-door neighbor, who has a leased system, how that would be handled, and he admitted he did not know.)
One more thing. The installed cost of the system on my roof was $18,700 and we got $6,500 back in federal and state tax credits, so total cost to me was ~$12,000. But this is for a 60-year-old house that had the system retrofitted. For new construction, the cost would be less, as the wiring and the labor are integrated into the home's electrical design and construction. And for new construction that costs $250,000 (high for here), adding $10,000 price is in the noise, really. When I read that California was requiring solar panel installation on all new construction starting in 2020, I thought that was a no-brainer. When houses cost $500k and up, solar power cost is irrelevant. (People pay more for their kitchens.)