In reputable open-access journals, you can have the fees waived if you don't have grant or institutional funding that's earmarked to pay for publication/dissemination of research. What usually happens is that universities take at least some of the budgets they previously used to buy journal subscriptions, and put them towards publication fees instead. NIH and NSF and those kinds of grants will also pay publication fees (along perhaps with other ways of disseminating research). If you have access to neither, then you don't pay. Here's is the policy from PLoS, for example: https://www.plos.org/publications/publication-fees/plos-publ...
In CS there are typically no fees to begin with, at least in the areas I work in (JMLR and JAIR are no-fee open-access journals). Instead journals are run basically without staff, authors format their own documents in LaTeX, and an institution (in the case of JMLR, MIT) donates some server space and maybe the time of a student assistant. The main downside to this is that publication quality control tends to be a bit worse, as there's no copyediting or layout type of service (JMLR has quite a few surprisingly badly edited papers, despite being a generally good journal). But it is usually "good enough".
In CS there are typically no fees to begin with, at least in the areas I work in (JMLR and JAIR are no-fee open-access journals). Instead journals are run basically without staff, authors format their own documents in LaTeX, and an institution (in the case of JMLR, MIT) donates some server space and maybe the time of a student assistant. The main downside to this is that publication quality control tends to be a bit worse, as there's no copyediting or layout type of service (JMLR has quite a few surprisingly badly edited papers, despite being a generally good journal). But it is usually "good enough".