There is no answer to this for two reasons:
First, Tolkien deliberately did not write about the details of his magic system. He felt that magic was closely related to wonder, and for magic to produce wonder, it needed to be mysterious and not a technology. You'll note that he rarely said anything about how things happened and the greatest practitioners were not even sure that what they did was magic. Galadriel said:
'And you? ' she said, turning to Sam. 'For this is what your folk would call magic. I believe; though I do not understand clearly what they mean; and they seem also to use the same word of the deceits of the Enemy. But this, if you will, is the magic of Galadriel. Did you not say that you wished to see Elf-magic? '
To the extent that we can speak of where magic comes from, it comes from the essence of the being doing it. It's built-in, so to speak, and thus might be quite different from person to person.
'Are these magic cloaks? ' asked Pippin, looking at them with wonder.
'I do not know what you mean by that,' answered the leader of the Elves. 'They are fair garments, and the web is good, for it was made in this land. They are elvish robes certainly, if that is what you mean. Leaf and branch, water and stone: they have the hue and beauty of all these things under the twilight of Lórien that we love; for we put the thought of all that we love into all that we make. Yet they are garments, not armour, and they will not turn shaft or blade.
Secondly, Tom Bombadil himself was left by JRRT as an enigma in an already enigmatic world. He commented that he felt that every world should contain mysteries that can't be explained and that Bombadil was one such. In letter #144 he noted that Bombadil has a role outside the struggle that has dominated both side in Middle-Earth for close to ten thousand years:
Tom Bombadil is not an important person – to the narrative. I suppose he has some importance as a 'comment'. I mean, I do not really write like that: he is just an invention (who first appeared in the Oxford Magazine about 1933), and he represents something that I feel important, though I would not be prepared to analyze the feeling precisely. I would not, however, have left him in, if he did not have some kind of function. I might put it this way. The story is cast in terms of a good side, and a bad side, beauty against ruthless ugliness, tyranny against kingship, moderated freedom with consent against compulsion that has long lost any object save mere power, and so on; but both sides in some degree, conservative or destructive, want a measure of control. but if you have, as it were taken 'a vow of poverty', renounced control, and take your delight in things for themselves without reference to yourself, watching, observing, and to some extent knowing, then the question of the rights and wrongs of power and control might become utterly meaningless to you, and the means of power quite valueless. It is a natural pacifist view, which always arises in the mind when there is a war. But the view of Rivendell seems to be that it is an excellent thing to have represented, but that there are in fact things with which it cannot cope; and upon which its existence nonetheless depends. Ultimately only the victory of the West will allow Bombadil to continue, or even to survive. Nothing would be left for him in the world of Sauron.
If we don't have a science of the magic of Middle-Earth and if Bombadil was an enigma on top of that, and outside the geospiritual forces at play, we surely can't understand what he did with the Ring.