She knew she was being robbed because he was pointing a gun at her. That and the fact he had clearly said, “this is a robbery”, so there really shouldn’t have been any confusion. And yet Mary did feel confused.
According to the bank’s training videos (and all the Hollywood films) the robber’s supposed to burst in shouting, waving his gun around and generally scaring the pants off everyone. He was supposed to say things like “Everybody down on the ground!” (Not that it would’ve done much good since the only other person in the vicinity was Mr. Hogan and he was as deaf as a post), or “hand over the cash before I blow your brains out!”, or perhaps “your money or your life” (oh wait, scratch that one, she was thinking of highway men).