The Gemora analyzes the case: If he is speaking about a case where he declared the vow while he was in the cemetery, and people warned him before his vow, “Do not utter this vow,” why would loitering be necessary? A nazir who enters a cemetery is punished without lingering because he was warned against entering (and he refused to listen); so too, here, he was warned (and he intentionally went against it)!
Tosfos asks: Shouldn’t this be regarded as a violation without performing an action? Why would he receive lashes for declaring himself to be a nazir?
Tosfos in Shavuos writes that the Gemora is in accordance with the opinions that maintain that one can receive lashes even without committing an action.
Tosfos here answers: Although he cannot receive lashes for the acceptance of the nezirus while inside the cemetery (for that does not entail an action), he will receive the lashes for continuing to remain in the cemetery after the acceptance of nezirus. That does constitute an action.
The Steipler Gaon asks: Where is the action? Why is the fact that he refused to leave regarded as an action?
He explains: Anytime an action is performed through a person, and he has the ability to eliminate it, but willingly refrains from doing so, this is considered as if he has committed an action, even though it happened by itself. The fact that the nazir is standing in the cemetery refusing to leave, that constitutes an action.
The Mishna Lamelech explains Tosfos differently: Tosfos maintains that although the transgression was committed without an action, he may receive lashes for the entering into the cemetery. Although no violation occurred at that time (since he was not yet a nazir), he receives lashes, since that was the action that led to the transgression.