Sam is the grocery store worker in the story. The first thing to remember about Sam is that he has no reason to suspect anything is wrong about Mary. I'm sure it is quite obvious to everybody that knows Mary and Patrick that Mary is absolutely infatuated with her husband, so Mary's run to the store for Patrick makes sense.
Now and again she glanced at the clock, but without anxiety: She merely wanted to satisfy herself that each minute that went by made it nearer the time when he would come home.
The author makes it clear that Sam knows Mary. He greets her by name. The author also makes it clear that Sam knows Patrick, because Sam knows that Patrick likes cake.
Mary's story about why she is at the store is quite ordinary and mundane. She and Patrick normally go out, but he didn't feel like it tonight, so she needs some groceries. She buys things that she would normally buy and acts perfectly cordial the entire time.
Mary is able to act this way because that's exactly what she is doing -- acting. Mary spent some time at home making sure her make up was correct and practicing the lines that she would say to Sam. To answer your question in the simplest way possible, Mary manipulates Sam because she rehearsed the entire scene beforehand.
Mary Maloney was knowing Sam as he was near to his house. She often visit him for purchasing grocery items. He knew both Mary and Patrick very well so it was easy for her to make him believe the story as he knows the good relation between Patrick and Mary.