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 (relatively) all the time in the world to do it. Three to five seconds before you get your receipt or change is no big deal, but did you know that the bill counters at banks (and the like) are actually detecting counterfeits at the same time they are counting not only bills, but distinguishing values all at the same time, and those babies FLY. The run though 20 bills/sec. and many can distinguish b/t unsorted currency from several countries at once. THAT is what I’ve always wondered about. But I’m easily impressed by the technology.