When does Regina stop being the mayor? I mean, when does she pass her duties to Mary Margaret?
Mary Margaret became Mayor in the episode "White Out", the 2nd episode of Season 4.
A blackout strikes the town. David and Emma investigate the issue at the border as Mary Margaret stays home. Unexpectedly, Granny, Happy and Leroy persuade her into fixing the power issue. She balks, as this is a task for the mayor, but they believe Regina no longer wants the job. Granny stresses that Mary Margaret cast the last curse, so she must step up. Additionally, Leroy recalls they reclaimed her kingdom in the Enchanted Forest, but Storybrooke is her kingdom now, so she has to rule it.
Clip of the appropriate scene:
This deleted scene from the same episode has Regina passing the mayorship over to Snow (instead of the townspeople):