Here is what I think is going on, but I could be (possibly very) mistaken on the details.
Lean 3
Lean 3 has the ability to run in JS/WASM, so the Lean 3 web editor (which is what you linked to above) is actually running Lean in your browser if I'm not mistaken (GitHub source). The Lean 3 Natural Number Game runs the same way, using the Lean Game Maker.
Lean 4
I don't think Lean 4 has this ability (currently) to run in JS/WASM. So instead, one has to run it on a server and have an editor in the browser which communicates with the server as in the Lean 4 web editor (GitHub source and Zulip discussion). Similarly, see the Lean 4 natural number game, its GitHub source, the Lean 4 Game Server, and discussion on Zulip (which I think are all early works in progress).
In general, if you are interested in hosting something similar yourself, I would post more about it on the Zulip chat, solicit advice, and be prepared to get your hands dirty with lots of technology, since this is all very bleeding edge (especially Lean 4).