Its complicated, but my simple explanation is that the geared motor is a smaller motor, Less copper in it, less wide magnets, less total potential power.
So its a bit of an apples to oranges comparison. Run both types at say 1000w, and one is running at much more of its total potential than the other.
Then there is the load. The potential load for a dd is a bit more weight than the smaller copper geared. So the same weight, the geared is more overloaded than the DD. Once overloaded, the design of the DD motor sheds heat faster, so it can run longer before the melt down than the geared, which has trouble shedding heat very fast. So,,, don't overload and overheat.
DONT overload either, and either one can climb hills magnificently. Both can climb amazingly long hills of 10% grade, if the total weight of the entire bike and rider is under 300 pounds. Or steeper, if the weight is even less. Part of what I did when I worked for E-Bikekit.com, was overload the motors and ride up mountains. We needed to know what the max load really was, and then we could warranty the motors for less, at 300 pounds.
What I keep wishing to see, is a geared motor with just as much copper weight, and just as many magnets, as the typical DD. It might even have to be heavier than the 15 pound 500w dd motor. But it could handle 2000w easy, and climb walls. Its size would allow even lower gear ratio than 5 to one, and its use would be pedicabs.