Damn sorry man, that sucks. In your car and back is whack, the person behind you in line might have taken it... I wonder if you were to leave that $40 behind 10 years ago if it would have lasted until you got back. Shit I think it would be interesting do to a hidden camera and ask people why they took it, or why they left it behind.
Keeping lost money is a grey area for me - I found $20 lying on the ground at Excalibur in Vegas as a kid and kept it. Not sure what I would do if I found $40 sitting in one of those machines though. I think I would be inclined to take it to customer service, feeling safe that the only person looking to claim $40 would be the person who left it behind.
I saved up to buy a pair of Oakley's as a kid and left them at my doctors office. The SOB set them out in the waiting room, not realizing exactly what they were. Needless to say some asshole stole my sunglasses. I look back on that situation as a life lesson that no matter what it is that's left behind you can never claim to know how important it might be to someone. So to this day whenever I find something that is not mine I always try to go the extra mile to try and make sure it ends up in its owners hands. I know I wish that's what the dickhead who stole my sunglasses had done.
It's definitely a philosophical question though. If you found that somebody left $40 behind would you act differently than if you found their $40 sunglasses?