The image processing happens locally in the web browser.
Not to imply that hosting the static assets to power that (JS and WebAssembly binaries) is free, but it's definitely much cheaper than the compute resources that would be required to do the heavy lifting server-side.
(Still worth paying for or allowing ads though. Photopea clearly took a lot of work to build)
FWIW, I have had some Google (now Nest) Home Hubs for years and I don't think I've ever seen or heard ads on them.
I'm gradually de-googling my life though, so maybe I'll just replace them with some DIY thing