Providing a cash refund means that their staff have to take cash out of the till. Having your contact details means that they're able to check up whether the member of staff took the money out for a legitimate reason (or simply to put it in their pocket).
There are also some scams (often where a member of staff works in league with a shoplifter) involving exchanges so, once again, management like to be able to check that there was nothing untoward happening.
Chris, I can see your point about cash from the till, but with a debit or debit card the transaction would be electronically recorded anyway (although I suppose someone could have more than one card if fraud was their main aim).
What annoys me most is that there is no guarantee that they won't use the details to send you junk mail.
I heard that it was to prevent fraud ie if someone bought an item of clothing, left it home, returned to the shop with the receipt and lifted an identical item and took it to the till for a refund.
In this situation the shops stock levels would be wrong and they would have the contact details of the person who returned the item