How can vending/self-checkout machines tell the difference between fake money and real money?

To me, the question isn’t how do they do it, but “how do they do it so damned fast?” The vending and checkout machines you’re talking about are only dealing with one or a few bills at a time, and have