All this talk about ideal and non-ideal motors makes my head spin while regenerative braking makes me think "hold on a moment." How and where does the motor get the mechanical energy that is needed to raise the weight? I suggest scenario 3 in between the ones suggested by OP:
Scenario 3: The robotic arm is holding the box at fixed height for a length of time ##t##. There is no raising and no lowering of the mass. Naturally, a feedback mechanism is needed to keep the mass fixed in position. If more mass is added to the box, something has to "work harder" to keep the increased mass in place. The input power to the motor has to increase for no apparent gain in mechanical energy.
My point is that, before one begins to argue where the mechanical energy goes when the robotic arm raises or lowers the mass, one has to understand where the mechanical energy comes from and where it goes when the mass is kept in place against gravity, ohmic losses notwithstanding.
A conceptually simple model to visualize electrical energy needed to keep a mass in place against gravity is a current-carrying wire segment of mass ##m## levitating in an external magnetic field. The magnetic force opposing gravity is ##\mathbf{F_M}=I\mathbf{L}\times\mathbf{B}##. The current needed would be ##I=\dfrac{mg}{BL}.## An actual device that uses this idea is the
current balance.
In this simple case, if the mass is doubled, twice as much current will be needed through the wire to keep it in place. That means 4 times as much ##I^2R## loss which is a separate issue from mechanical energy and does not address where (or in what form) the
change in mechanical energy ##mg\Delta h## appears.
In very general terms, this conceptual electric motor takes in electrons at high (mechanical) potential energy and returns to the power company electrons at low (mechanical) potential energy while doing mechanical work and dissipating some of that mechanical energy as heat. The reference point of mechanical energy is the energy needed to keep the mass at fixed height for time interval ##T##. Call it ##E_0=N_0e\Delta V## where ##N_0## is the number of charges returned to the power company at lower potential energy and ##\Delta V## the voltage drop across the levitating wire.
In Scenario 1 the current is adjusted in such a way as to raise the wire by ##\Delta h## in time ##T## and have it be at rest at the higher level. In that time interval the energy needed to do this is ##E_{up}=N_{up}~e\Delta V##. Of course ##N_{up} > N_0.## The positive change in energy intake is due to the work ##mgh## that the electrical force does on the mass against gravity, the mechanical work needed to kill whatever kinetic energy the mass has acquired when it reaches the desired new height plus any new dissipative losses that are incurred as a result of the change in height. We can write ##\Delta N =\dfrac{mgh}{e\Delta V}## to represent the number of charges that contributed to convert electrical potential energy to gravitational potential energy. Raising the mass to a higher level requires ##\Delta N## more electrons to lose potential energy than just having the mass sit at fixed height in Scenario 3.
In Scenario 2 the current is adjusted in such a way as to lower the wire by ##\Delta h## in time ##T## and have it be at rest at the lower level. In that time interval the energy needed to do this is ##E_{down}=N_{down}~e\Delta V##. The number of low potential energy electrons ##N_{down}## is less than ##N_0## by ##\Delta N =\dfrac{mgh}{e\Delta V}##. In other words, the decrease in gravitational potential energy ##\Delta U_g=-mgh## "appears" as a decrease in electrical potential energy ##\Delta U_g=-\Delta N~ e\Delta V## in time ##T## at the source and a lower electricity bill. Using less power might be construed as "producing power".
This ended up being longer than planned, so I stop here. I don't know much about motors either.