I’m Editor in Chief of a society-connected “diamond” open journal. (That means open access and no page charges; this is the model that is growing most rapidly.) I think the reality is somewhere between the common “all the work is done for free by academics” narrative and the “oh but we add so much expensive value” reply from publishers.
I agree that there are real material costs (hosting, DOI fee, etc), but for an online-only journal those are small enough that they can be easily carried by library or association or departmental incidental budget.
The labor expense (on top of the ones like refereeing that people always talk about) is a real cost. My journal is all volunteer, but that limits our size; we would break at 20% more papers accepted. I can barely run the journal and do my day job, if we were not a narrow specialty journal we’d absolutely need a paid staff.
A large chunk of the man-hours is in copyediting, which we do carefully, but honestly the level of copyediting at many commercial STEM journals is abysmal: I see problems all the time in articles in Science which would never pass our review.
Finally, you mention publicity. This is field-dependent; in my small field people know my journal and my board is distinguished, so we have no need for a publicity budget, but I know it can be expensive to buy book display floorspace at the big academic meetings or ad pages in other journals or even on blogs
Scholarly publisher profits (and journal costs) really skyrocketed in the 1980s, possibly thanks to deliberate market manipulation by the likes of Robert Maxwell, but clearly well beyond the actual expense of running the journals. Pirates like Sci-Hub could be forcing a much-needed correction.