Most types have a small thermally-insulated tank with a heater which keeps the water in the tank hot.
When the handle is pressed, cool tap water flows into the tank and displaces the near-boiling water, which flows out of the spout.