I think it's just a case of the difference between handling the ring for a short period, and being given possession of the ring.
Gandalf perhaps felt safe enough just examining the ring for this short period, believing his own strength and his love for Frodo would keep him from any harm during such a brief handling.
Offered the prospect of owning the ring, however, when the temptation over time to use it would become too great to resist, was another matter. Gandalf knew over time it would corrupt even him, and so refused guardianship of it.
I think the temptation to use the ring is also a key factor here. By examining the ring, Gandalf had no temptation to use its powers. I think it's through using these powers that the ring gains a stronger control over its wielder.