I think that you will find that G4S and other such companies employ people specifically for this purpose. They are actually trained in travel documentation and know a lot more than those on check-in. In fact the airline staff will often ask the security people if they have a query.
These people often used to work for specialist companies as IAS, ADI and such like before they were taken over. The airlines employ them to check documentation at the gates specifically to do a final check on all passengers which will then include transit pax, who will have bypassed check-in.
It really does not have anything to do with US Immigration, it is purely to ensure that the airline can be sure that the passenger is not going to be refused entry to the US and any associated repercussions.