The merchants refund credit card purchases to the credit card used to make the purchase because Visa, MasterCard, and American Express rules mandate it. The merchants would be in violation of their contract/agreement with their credit card processor or the card networks if they gave refunds in a different form (eg. cash, or to a different card.)
Merchants who don't follow the rules have an increased risk of chargebacks*, can get their interchange rates raised, or could lose the ability to accept that type of card.
* Someone could buy something, return it and get cash, and then file a chargeback saying the refund never posted. The merchant would then have to admit that they refunded cash improperly, or issue a refund to the credit card, or the card issuer will do the chargeback. The chargeback can still happen even if cash was refunded since the rules were violated.