If you recollect the book, in the end Frodo did the same thing Gollum did: claimed the ring as his own.
Gollum got a lava bath, Frodo was celebrated and revered as a hero and went to eternal bliss in the closest thing Tolkein's world had to heaven.
What's fair about that?
Maybe Tolkein's god didn't care about fairness.
Because when Deagol found the One Ring, his cousin Smeagol decided that since it was his birthday Deagol should give him the Ring. Deagol refused and Smeagol murdered him and took the Ring as his own. Ultimately Smeagol became known as Gollum.
As for Frodo, as he got closer to Mordor the Ring got heavier and heavier, not just physically but psychologically as well. Once he reached the furnace of Orodruin where the One Ring was forged its power finally overwhelmed him.
So Gollum came into possession of the One Ring via envy and murder.
Frodo came into possession of it because Bilbo willingly (more or less with some serious prompting from Gandalf) gave it to him. It wasn't until Frodo was in the heart of Mordor standing before the furnace of Mount Doom where the One Ring was created when he claimed the Ring as his. He was dealing with the full power of the Ring by that point. It's likely nobody in Middle Earth could have withstood the influential power of the Ring if they had been in possession of it while standing by the forge where it was created.
If you look at Bilbo, he possessed the Ring for 60 years and while it extended his life span, it hadn't corrupted him in all that time.
Also. Frodo didn't go to "heaven". Mortals don't live long in the Undying Lands. Frodo got to go there to heal from his hurts and wounds. It was a respite before he peacefully passed away shortly after. By the time Sam went there Frodo was long dead. And by the time Legolas and Gimli arrived there, Sam had been long dead as well.