A valve or seal at the top of the pump allows air into the cylinder when the handle is pulled up.
The tyre has a valve which allows air into the tyre but does not allow air out. When the pump handle is pushed down, air is forced into the tyre. When the handle is fully down the it is pulled back up. No air is allowed to escape from the tyre, but air can empty the pump cylinder via the seal at the top and the process of pumping can be repeated.