That's a silly measure, though, and not what anyone actuallywants to know when deciding their eating habits. What matters is amortized dollars per calorie, or maybe dollars per time period, and grocery shopping easily beats fast food on that.
the articles I've seen that provide more detailed analysis typically suggest that you can get more "poor quality calories" from fast food. The real challenge here is most comparisons completely ignore prep and cook time as a cost, but that matters a lot for busy parents who don't have time to make the cheapest possible stew out of the cheapest ingredients.
Fast food bulk-buys, prepares at industrial scale, and automates as much as possible. It's going to be hard to fight against that level of volume discounting.
Prep time is a real concern, but a vastly more complicated one than comparing dollar amounts. Even if you manage to figure out a fixed dollar cost of prep time, most people aren't in a position to directly trade hours between food prep and making money.
Anyway, as long as we're throwing random cost factors into the air, fast food has much bigger labor, utilities, and real estate costs that their food prices have to cover. And individuals can do pretty well buying bulk if they put in the effort. But we talked about effort already. It's definitely not going to be simple if you want to fully quantify all the tradeoffs, but if you just count dollars, well, there's a pretty wide spread of effort levels where you can beat fast food.