Mary Warren is the Proctors' maid or servant. When she comes back from court in Act II scene 2, explaining where she was and why, John is extremely angry with her for leaving without his permission. He is violent towards her, and once she tells him that she must go again to court the next day, he whips her. She is treated very much like the servant she is, and because of her defiant behavior, she is treated like a little child who doesn't obey her strict parents and deserves a "spanking."
Once she is cornered in court at the end of that same scene, Mary turns the tables on Proctor. She makes him out to be a devil's follower and she unites with Abigail, knowing that she holds the power over the court and the people in it. Mary screams at Proctor, "No, I love God; I go your way no more!" And with that, she has gained a power she has not yet held. She is treated as an adult and they begin to believe all she says. She realized that her only way to make others listen to her was to join Abigail. So Mary was a dynamic character who went from a whimpering little girl to a powerful ally to Abigail, and was treated accordingly.