My concerns relate to the almost-inevitable "snap" when the gun hits the magnet thereby damaging the finish. That rubber-coated magnet might do the trick, though
Another concern is if the magnet is attached to the surface only by its own magnetism, you may end up pulling the magnet off with the gun, making it darned unhandy to use.
I believe it might be possible for a magnetized gun (and it will be, to at least some extent) to negatively affect little things like inertial firing pins and firing pin block linkages. But that's a big maybe, since the whole gun, including the lockwork, will be magnetized in the same direction. That's an "I dunno," for sure, but I see it as a possibility.
Hard steel, by the way, is easily permanently magnetized even by the earth's magnetic field, let alone by being held up by a magnet strong enough for it to hang from.
Take a screwdriver, point it north, rap it a couple of times with something hard, and you will find it can then pick up small pieces of iron, like tiny screws. Sometimes that's good, sometimes it's bad. I keep an old bulk tape eraser handy to demag tools when necessary.
Terry, 230RN