You can fight back if they punch you. If they have a gun, and you do too, then one of you will likely wind up dead.
That said, there are worse ways to be mugged. I had a friend develop a pretty bad smelling problem, and his sponsor in NA used to mug people by sticking a dirty needle into their neck and threatening to inject them with whatever was in it. Pretty savage.