For me the only reason is that Sam loved Frodo. He knew taking the thing while Frodo lived would be the greatest torture for Frodo. He realises he can't make Frodo part with the ring without doing great psychological/physical harm to him. At the very end, instead of carrying the ring, he carries Frodo on his back to the doors of Mount Doom.
Sam takes the ring when he thinks Frodo is dead
This means he is not averse to fulfilling the quest on his own.
When Frodo was poisoned by Shelob and Sam though he had passed away, Sam was overwhelmed with grief. He couldn't leave "dead" Frodo but he also understood that he had to go on. His struggle is depicted in Book-IV(Chapter-10) (emphasis mine),
'What shall I do, what shall I do?' he said. 'Did I come all this way
with him for nothing?' And then he remembered his own voice speaking
words that at the time he did not understand himself, at the beginning
of their journey: I have something to do before the end. I must see it
through, sir, if you understand.
'But what can I do? Not leave Mr. Frodo dead, unburied on the top of
the mountains, and go home? Or go on? Go on?' he repeated, and for a
moment doubt and fear shook him. 'Go on? Is that what I've got to do?
And leave him?'
'If I'm to go on,' he said, 'then I must take your sword, by your
leave, Mr. Frodo, but I'll put this one to lie by you, as it lay by
the old king in the barrow; and you've got your beautiful mithril coat
from old Mr. Bilbo. And your star-glass, Mr. Frodo, you did lend it to
me and I'll need it, for I'll be always in the dark now. It's too good
for me, and the Lady gave it to you, but maybe she'd understand. Do
you understand, Mr. Frodo? I've got to go on.'
'What? Me, alone, go to the Crack of Doom and all?' He quailed still,
but the resolve grew. 'What? Me take the Ring from him? The Council
gave it to him.'
But the answer came at once: 'And the Council gave him companions, so
that the errand should not fail. And you are the last of all the
Company. The errand must not fail.''Let me see now: if we're found
here, or Mr. Frodo's found, and that Thing's on him, well, the Enemy
will get it. And that's the end of all of us, of Lorien, and
Rivendell, and the Shire and all. And there is no time to lose, or
it'll be the end anyway. The war's begun, and more than likely things
are all going the Enemy's way already. No chance to go back with It
and get advice or permission. No, it's sit here till they come and
kill me over master's body, and gets It: or take It and go.' He drew a
deep breath. 'Then take It, it is!'
So Sam reluctantly took over this burden. Thereafter he also had to put it on to escape the orcs.
Sam is not easily corrupted by the lure of the ring
When he realised Frodo was not dead (having heard the orc leader speak about this), he was besides himself with anger and all his earlier resolve was forgotten. In Book Six(Chapter-1) we see that Sam only wants to rescue his master and is not tempted by thoughts of being THE ring master.
He no longer had any doubt about his duty: he must rescue his master
or perish in the attempt.
As Sam stood there, even though the Ring was not on him but hanging by
its chain about his neck, he felt himself enlarged, as if he were
robed in a huge distorted shadow of himself, a vast and ominous threat
halted upon the walls of Mordor. He felt that he had from now on only
two choices: to forbear the Ring, though it would torment him; or to
claim it, and challenge the Power that sat in its dark hold beyond the
valley of shadows. Already the Ring tempted him, gnawing at his will
and reason. Wild fantasies arose in his mind; and he saw Samwise the
Strong, Hero of the Age, striding with a flaming sword across the
darkened land, and armies flocking to his call as he marched to the
overthrow of Barad-dur. And then all the clouds rolled away, and the
white sun shone, and at his command the vale of Gorgoroth became a
garden of flowers and trees and brought forth fruit. He had only to
put on the Ring and claim it for his own, and all this could be.
In that hour of trial it was the love of his master that helped most
to hold him firm; but also deep down in him lived still unconquered
his plain hobbit-sense: he knew in the core of his heart that he was
not large enough to bear such a burden, even if such visions were not
a mere cheat to betray him. The one small garden of a free gardener
was all his need and due, not a garden swollen to a realm; his own
hands to use, not the hands of others to command.
His heart is not corrupted by the ring (again the love for Frodo plays its part).
Sam sees the control ring has over Frodo
When he finally rescued Frodo and gave the ring back to him he was amazed at the pull ring had began to exert on Frodo.
'All right, Mr. Frodo,' said Sam, rather startled. 'Here it is!'
Slowly he drew the Ring out and passed the chain over his head. 'But
you're in the land of Mordor now, sir; and when you get out, you'll
see the Fiery Mountain and all. You'll find the Ring very dangerous
now, and very hard to bear. If it's too hard a job, I could share it
with you, maybe?'
'No, no!' cried Frodo, snatching the Ring and chain from Sam's hands.
'No you won't, you thief!' He panted, staring at Sam with eyes wide
with fear and enmity. Then suddenly, clasping the Ring in one clenched
fist, he stood aghast. A mist seemed to clear from his eyes, and he
passed a hand over his aching brow. The hideous vision had seemed so
real to him, half bemused as he was still with wound and fear. Sam had
changed before his very eyes into an orc again, leering and pawing at
his treasure, a foul little creature with greedy eyes and slobbering
mouth. But now the vision had passed. There was Sam kneeling before
him, his face wrung with pain, as if he had been stabbed in the heart;
tears welled from his eyes.
'O Sam!' cried Frodo. 'What have I said? What have I done? Forgive me!
After all you have done. It is the horrible power of the Ring. I wish
it had never, never, been found. But don't mind me, Sam. I must carry
the burden to the end. It can't be altered. You can't come between me
and this doom.'
Frodo himself explained to him that it was his destiny to destroy the ring and I think Sam too saw that he could not "take" the ring without hurting Frodo (also he felt no inclination to do so)
The scene that you have referenced happens in Book-Six(Chapter-3)
'I can't manage it, Sam,' he said. 'It is such a weight to carry, such
Sam knew before he spoke, that it was vain, and that such words might
do more harm than good, but in his pity he could not keep silent.
'Then let me carry it a bit for you, Master,' he said. 'You know I
would, and gladly, as long as I have any strength.'
A wild light came into Frodo's eyes. 'Stand away! Don't touch me!' he
cried. 'It is mine, I say. Be off!' His hand strayed to his
sword-hilt. But then quickly his voice changed. 'No, no, Sam,' he said
sadly. 'But you must understand. It is my burden, and no one else can
bear it. It is too late now, Sam dear. You can't help me in that way
again. I am almost in its power now. I could not give it up, and if
you tried to take it I should go mad.'
So here Frodo himself answers your question. He has finally succumbed to the ring's power and Sam can't take it from him by force without doing serious harm to Frodo. We know Sam loves Frodo too dearly (and is also too wise) to attempt anything so foolish. Thus when the time comes, he makes his decision
'Come, Mr. Frodo!' he cried. 'I can't carry it for you, but I can
carry you and it as well. So up you get! Come on, Mr. Frodo dear! Sam
will give you a ride. Just tell him where to go, and he'll go.'