Would I fuck over the type of people who carry $40,000 in cash? No, I don't think I would.
It's not like money occurs naturally, so obviously that money belongs to someone, someone who has a good reason, but also an illicit reason, for having such are large and exact amount of cash in a bag rather than in the bank.
If there was no way of quickly tracing the owners, i.e. something with their phone number in the bag so I can immediately tell them I'd found their money and arrange to return it (an address on it's own wouldn't be good enough because there's no way I'd risk running into the owners with their money unless I'd informed them I was returning it beforehand), then I'd just leave the bag where I found it and let it be someone else's problem - handing in potential drug money to the police probably isn't wise either, as it could easily be construed as a form snitching.
$40,000 isn't really a lot of money anyway, certainly not enough to risk my permanent well-being by taking it, although if I could definitely return it without any trouble or misunderstanding, then even a 0.5% finders fee would be a better result when you weight up the risk vs. reward.