Keep the money.
The ATM would have swallowed it back and re-credited the cardholders bank. Now you have taken it, the persons account will be debited. HOWEVER, the actual cardholder can still get the money back, by speaking to the card issuer and saying they never received the money. The issuer would then do a chargeback and give the cardholder a credit, so all's well.
I have heard of people withdrawing money, but rather than pulling all of it out, pull the notes between the top and bottom, so the top and bottom are not dislodged from the machines grip, and apparently it doesn't think you have taken the full amount and re-credits your account the whole amount you requested.
Personally haven't seen it but have heard [work in bank].