Problem with simulating LC filter with N channel MOSFET used for PWM
In your first circuit V1 acts like the output of a synchronous buck power modulator, or a half bridge. No matter the state of V1, current in L1 has a good path. 

In your second circuit, when M1 is turned off, current in L1 has no place to go, and an impossible situation occurs. That's what Andy is talking about, using a flyback diode to give L1 current a path to flow when M1 is off. 

If you want to continue to use an N-Channel FET and switch it referenced to ground, you could change the circuit to something like this: 



This is a buck with Vout referenced to V1 (12V) so, Vout (voltage across C1 referenced to ground) will be V1 - D V1, where D is the duty cycle.