As for fax-relay, the gateway demodulates the signal sent by the modem and send it over IP network by using the Simple Packet Relay Transport (SPRT) protocol. The remote gateway process it at the reverse side.

Modem pass-through is similar to pass-through as everything is sent in-band.