Tomatoes, as you may know, originate from South America. The world of Middle-earth on the other hand is based on Europe, with the Shire at the latitude of Oxford, in a fictive but nonetheless long gone age, way before the discovery of America. Therefore, tomatoes should be unknown to Hobbits but this would apply as well for potatoes and pipeweed (tobacco)! Even more shocking, tomatoes are in fact mentioned in the first edition of The Hobbit as part of Bilbo's pantry.
How is this paradox to be resolved? It is all about the creation process of Tolkien's works. The Hobbit was intended as a children's story, a light, entertaining tale, connected but not yet rooted to the lore of Middle-earth. It reflects in it the time and circumstances at the time of its creation. In the 1930's England, the author and its audience were familiar with these plants, they had been cultivated crops for centuries. Indeed, to make Hamfast Gamgee (Sam's father) cultivate potatoes, these having become such a fundamental and everyday vegetable, seems very natural in this context. Not to mention tobacco, its popularity among Hobbits, one might strongly suspect, mirroring Tolkien's own fondness of smoking a pipe. In the same playful mindset, Tolkien even goes so far as to compare the sound of Gandalf's fireworks to an express train, an analogy very well understood by the reader but otherwise completely out of place.
It is only in the subsequent works, the six books of The Lord of the Rings, that the Hobbits take their place in a more serious adventure, where the underlying lore of the First and Second Age surfaces in Sam reciting a poem about Gil-galad, Aragorn singing of Beren and Lúthien or Gimli talking about the past of Khazad-dûm. The tissue of the tale is more consistent and great pain is taken to accurately describe the landscape and its flora along the journey undertaken by the members of the Fellowship. Perhaps the best example is the chapter "Of Herbs and Stewed Rabbit". In incredible detail a mediterranean setting is depicted, there is hardly any effort left for the mind's eye to imagine oneself in a fragrant forest in Ithilien.
No more talk of tomatoes in there, and Tolkien himself offers an explanation for potatoes and pipeweed: they were brought to Middle-earth by the Númenóreans (hence Galenas "the Sweetleaf" is known in Gondor, but only for its fragrant flowers), this ocean crossing from west to east probably being preceeded by yet another one. In Valinor, the utmost west (before the Third Age) "all living things that are or have been in the Kingdom of Arda [...] lived [...] and many other creatures that have not been seen upon Middle-earth [...]" (The Silmarillion, Of Eldamar). It is plausible this applies to plants, too. The Elves of Tol Eressëa thus would come to Númenor and bring with them previously unknown plants (not least a sapling of the White Tree) as described in the Akallabêth.
With this in mind, Tolkien obviously anticipates history and simultaneously provides a logical explanation for the ocurrence of two of the Hobbits most basic crops. But this also shows his desire to stay in frame; apart from these two plants that have become so deeply rooted in the Old World, no other New World crops play a role in Middle-earth. Not even tomatoes, since Tolkien changed their only mention into pickles in the third edition of The Hobbit.
For anyone interested in the plantlife of Tolkiens universe, I strongly recommend "Flora of Middle-earth" by W. Judd. This book describes every single plant found in Middle-earth and beyond from a scientific, botanical point of view, its setting within Middle-earth and the real world as well as its uses.
"Flora of Middle-earth", Walter S. Judd & Graham A. Judd, Oxford University Press, 2017
On a sidenote concerning the gameplay: the importance of potatoes as food is further proven by Mojang themselves. The developers naturally based aspects of the game on their everyday experiences, thus the ingame food is common enough to western players. This is valid for both crops and meat. One can only speculate if the game, had it been developed somewhere else in the world, would have included rice, corn, tropical fruits, various seafood or other more "exotic" food items (from a European point of view) instead of wheat, bread, apples and potatoes.
Crossbuilder Amateur Scholar (I build and translate)