> I assumed they'd put some device on the exhaust
They used to do it that way. Still do, for some cars, although the pre-ODBII set is now out of smog regs in most states.
Turns out the tailpipe breather machines are finicky and difficult to calibrate, causing false positives and false negatives (sometimes corruptly).