The second example that you have described containing an ideal (no resistance and capacitance) inductance and an ideal (no resistance) ac voltage source has to be carefully analysed because it does not occur in the real world.
The differential equation which governs the behaviour of both examples is of the form $L\frac{dI}{dt}+RI+\frac{Q}{C}= V(t)$.
The solution to such an equation will have two parts.
A transient behaviour with a frequency which is the natural frequency of oscillation of the system $\omega_0^2 = \frac{1}{LC}$ and a steady state behaviour which is more easily observed after the transients have died dowm.
In both examples the capacitance is assumed to be be very small and so the transient behaviour dies down very quickly and you are left with the steay state.
In your first example you have a step function which results a current of constant value in the steady state with the voltage across the resistor equal to the voltage of the voltage source.
In effect you have a system which is heavily damped.
In the second example after the transient has died down you have an LCR circuit with both $R$ and $C$ very small but still there in that you can only say that the applied voltage is approximately equal, but not exactly equal, to $L\frac{dI}{dt}$.
So here when the magnitude of the current through the inductor is increasing energy is flowing from the voltage source and being stored in the inductor (with a small amount dissipated as heat in the resistor) and then when the magnitude of the current is decreasing then the energy stored in the inductor is being given back to the voltage source.