A function retains access to bindings in the lexical environment where it was created. Each factory call creates a separate environment, so two returned counters can retain separate state. A closure captures access to bindings, not a frozen copy of every value.
Follow-up Interview Question · Why can an event listener keep otherwise unused data alive?