Half Bridge with PWM- gate signal problem
You are correct: it is the inductive current causing your problem.

You can see from your simulation output that the voltage vs is sometimes greater than vrail.  During this time, M1 is conducting in the reverse direction through its body diode and back into the supply, regardless of the gate voltage.  When you put in a resistive load, the voltage will not exceed the rail, and hence M1 can be controlled by its gate.

Good luck!