Sounds like a bang stick to me.
When I was a child, my father had a shot gun looking gun, that shot 12 guage shells, by putting the shell in the short part of the barrel of the gun then taking the longer part of the barrel and pulling it against the shell and it would fire the gun. And boy did it have a kick. So the gun came apart in two pieces. We never new what the gun was called or what it was worth? Does anyone know?
I've seen examples of home-made "zip" guns that worked in that manner. Other than a distant similarity to some anti-shark weapons used by divers, I've never seen or heard of a commercial gun that functions exactly like you described.
Do you remember if it had any markings on it, or did it kinda look home-made?
"Placement is power" -- seen in an article by Stephen A. Camp
(RIP, Mr. Camp; you will be remembered, and missed)
Find the book Guns of the Appalachia, some gunmakers made those type of guns to sell cheap. You might find the answer there.