How it works
Prepaid orders pay the gateway fee and, if you use an outside gateway, Shopify's third-party fee. COD orders pay the courier's COD charge instead. Prepaid wins because far fewer prepaid parcels come back, so each order is weighted by its own RTO rate. When a prepaid order is refunded, Razorpay keeps its fee but Shopify credits its own back.
The last input matters most. People who take a discount to pay upfront tend to be the reliable buyers, so their RTO rate on COD would have been lower than your average. Lower it and watch how quickly the discount stops paying.
The defaults match Is a prepaid order really worth more than a COD order?