this type of implementation of the Transmission Gate (by pmos and nmos) makes it suitable to be used, along with inverters, to build any two-input logic gate...and this is according to Shannon's expansion theorem:
F(A,B) = A F(1,B) + Abar F(0,B)
So if you have 2 transmission gates...the input of one of them would be connected to F(1,B) and its control is A on NMOS and Abar on PMOS...and the input of the other would be F(0,B) and its control is Abar on NMOS and A on PMOS...the output of both is just one wire=> F(A,B)...which takes its value according to the level of A