If I were writing these terms, I'd want to include that clause so that if someone attempts to attack Apple financially by getting a lot of people together to buy apps and then refund them, Apple would have some discretion in terms of keeping enough money to offset the attack. It would be a tricky situation, but at the same time, by including that clause they also make the situation less likely to come up in the first place by making that attack vector less appealing.
There's also some other attack vectors I can think of that this renders less likely, like "let's get my big YouTube fanbase to all buy this one app today, then refund it near the end of the refund window, thus pushing this app to the top of the store at no cost to my YouTube fanbase but at cost to Apple!" This would give Apple the cover to keep enough commission to cover the attack. Given the known shenanigans played on the app store, this seems less like some bizarre far-out possibility and more like something that would be a routine thing done by sketchier app developers if the terms didn't make it a bad proposition like this.
But in a normal day-to-day transaction, the logic works out in favor of refunding it even if they do nominally have the contractual right to refuse to do so.
How would either of those situations (which are pretty much the same) cost Apple _financially_? If 10,000 people buy an app for 1$ each, the creator gets 7000$ and Apple gets 3000$. When they all get refunds. The creator refunds the 7000$ and Apple refunds the 3000$...