Here is what Tolkien had to say on the subject:
“‘…even in a mythical Age there must be some enigmas, as there always are. Tom Bombadil is one (intentionally).'” (Tolkien, Letter 144, p 174)
So, in reality, whether Bombadil has a purpose or not is beside the point. He is meant to be unresolved. Like the scattered references to the Silmarillion, Bombadil is supposed to inflame our curiosities. He is there because he is part of the fabric of Middle Earth. Who he is, or why he’s there is not the question. He is there to evoke wonder and awe; to bring to life the mythical, through the power of the unexplained.
Tolkien continues in other letters:
“‘Tom Bombadil is not an important person-to the narrative. I suppose he has some importance as a ‘comment’….if you have, as it were taken ‘a vow of poverty’, renounced control, and take you 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 to power quite valueless….Ultimately only the victory of the West will allow Bombadil to continue, or even to survive. Nothing would be left for him in a world of Sauron.'” (Tolkien, Letter 144, p 179)
“‘I don’t think Tom needs to philosophizing about, and is not impoved by it. But many have found him and odd or indeed discordant ingredient. In historical fact I put him in because I had already ‘invented’ him independently…and wanted an ‘adventure’ on the way. But I kept him in, and as he was, because he represents certain things otherwise left out…..he is then an ‘allegory’, or an exemplar, a particular embodying of pure (real) natural science: the spirit that desires knowledge of other things, their history and nature, because they are ‘other’ and wholly independent of the enquiring mind, a spirit coeval with the rational mind, and entirely unconcerned with ‘doing’ anything with the knowledge: Zoology and Botany not Cattle-breeding or Agriculture….Also T. B. exhibits another point in his attitude to the Ring, and its failure to affect him….The power of the Ring over all concerned, even the Wizards or Emissaries, is not delusion-but it is not the whole picture, even of the then state and content of the Universe.*'” (Tolkien, Letter 153, p 192) (*my italics)
The last statement above is, to my mind, the most important of all. Tom Bombadil exists as a mythical element, an enigma not meant to be solved. He also defines the one moment when the Ring no longer has power, is not the center of everything…to show there are other things in the world, for Good and for Ill.