swashplate
Leaving the gear down does cause drag of course but for a short time during the retraction cycle, the gear and the doors are down resulting in more drag. Also the movement of the gear and doors relative to the wings disrupts the airflow slightly.
Normally none of this makes any difference so the gear is retracted as soon as +r.o.c. But in a departure close to the limits (was going to say marginal) you might want to avoid any extra drag, however slight.
Not an everyday practice to be sure but I have seen it done more than once, most notably on 747s leaving Miami for Europe on a 90deg afternoon. The climb angle (or lack thereof !) on those guys has to be seen to be believed. More than once I have been afraid they'd run off the end of 09R but thankfully none did.