I've seen it done exactly as Rob says, and it can be done cleanly, too.Cut hole. Grab wire in wall pull through hole. Pull wire into box. Nail box to stud.
Not rocket science to see how it could be done.
Edit: I've seen a couple large remodels done by a guy in L.A. entirely that way. NM was left looped over a nail at each outlet, drywall hung, then boxes put in afterward. And no, I don't know how it ever got inspected.