Not to take anything away from Sam, but he wasn’t the first person to give up the ring. I’m talking about the moment in Cirith Ungol when he hands Frodo the ring back.
In the movies, Boromir gives up the ring when they’re climbing Caradhras. Remember Frodo tumbles, loses the ring, Boromir picks it up, and Aragon tells him to give it to Frodo? Boromir does.
Also, Frodo drops it into an envelope Gandalf is holding, and Gandalf seals the envelope and gives it back.
Gollum wouldn’t have done that.