For a stateful firewall (such as the Cisco ASA), it keeps track of tcp connections (and udp flows) in its connection table. When traffic is returning in response to an internally-initiated communication, that table finds a connection record and allows the return traffic to transit without requiring matching an access-list.
Only when traffic is initiated from outside does it need an explicit access-list to be allowed into the inside (or other interfaces of higher security level than outside).