The other driver is trying to avoid an insurance claim or getting the police involved. It is NOT illegal to take the cash, but it will cause more harm than good if it isn't enough. It could even be a scam.