The airline industry isn't perfectly competitive where we expect prices to be equal to marginal cost. Instead it's either in the realm of oligopoly or monopolistic competition. The top answer to this question argues that when you shop for a flight from LA to Chicago that the market price is $400 but when you buy a flight from LA to Bumblebutt which happens to stop in Chicago for $300 that you're depriving some subsidizing agency of that $100 because the only reason that pricing exists is because of a subsidy.
This is completely unsubstantiated. I challenge someone to find the airport that receives a subsidy based on number of passengers AND that skiplagged will find as a fake destination for their hidden city fares.
Instead, I content the existence of subsidies at certain airports isn't the driver of the aforementioned pricing weirdness. For instance, let's look up the EAS recipients
Now I look up a flight from my home city, Tampa, to the top result, Ernest A. Love Field, for 9/20/23. The price is $189. I can pull up the pricing calendar and see that it would be cheaper on 9/27, specifically it'd be $172. The layover airports, depending on what airline I pick are DEN or LAX.
Here's the screenshot of the top result:
Under the subsidy theory, flights to DEN or LAX would be even more than that $172 but that's not the case.
Here's Tampa to DEN with a nonstop filter on the same day...
Granted, this is just a single data point but interestingly enough I coincidently found a skiplagged flight to DEN with a fake destination of Charlotte. I can't find anything suggesting that any agency is providing a subsidy based on the number of passengers that land in Charlotte.
The reason airlines will sell A->B->C for cheaper than A->B is because they don't price the tickets according to their marginal cost, at all. It simply isn't part of the math that determines relative ticket prices. This is largely because the marginal cost of an additional passenger is pretty close to $0.
They price it to maximize revenue. The way they figure that out is the relative competition for any given city pair and the desirability of a schedule. That means that they'll figure out a price for A->B, A->C, A->D, A->E, etc. For each of these pairs, they will have a different price for the nonstop version vs the layover version and the former is almost always going to be a premium to the latter. Sometimes, it just so happens that the market dynamics are such that A->C with a layover is determined to have a revenue maximizing price that is lower than A->B nonstop AND that the layover city for that A->C ticket is B. If airlines charged you based on some fixed $/mile markup then, of course, this wouldn't exist but that's not what they do.