Just to add that in the first edition of the Hobbit then Bilbo got it fairly from Gollum by winning the Riddle game with the Ring staked against his life - though he finds out later that he actually had it all along and Gollum then shows him the way out as his side of the bargain when he can't find the ring - and they part amicably J.R.R. Tolkien Encyclopedia
And in the first drafts of the first chapters of the Lord of the Ring also (not published in his lifetime) - before it had that name - then Frodo also uses it as a simple invisibility ring, playing tricks on Farmer Maggot stealing a mug of beer from him Farmer Maggot - Tolkien Gateway
As time went on the LOR story became much darker as he continually revised it and the ring then took its final form - then he had to back-write this into the Hobbit. Which he did mainly by rewriting the riddle game chapter. He left the rest unchanged.
So that's the literary reason why it is treated in such a light hearted way in the hobbit.
But he also has an in universe reason for it also, that Sauron was weaker back then. Plus he presents the original version of the Hobbit as the ring working its effect on Bilbo right away - as a lie he told to the Dwarves and later wrote down in the book which the Hobbit is presented "in universe" as being based on.
For more about the "in universe" explanations, see the other answers, which go into a lot of detail, e.g. about the proximity of the dark riders, and later Mordor itself, and also that Frodo was going against the will of Sauron's influence on the ring - while for Bilbo then Sauron had no particular will about it at all as he thought the ring was lost. Etc etc.
So not saying any more here about the "in universe" reasons as it is well covered already in the other answers.