I think that he had walked to within sight of Maggot's fields, or at least knew where they were. Probably he also knew what Merry and Pippin had been up to, and then figured out for himself where the armfuls of groceries must have come form.
But I don't think they actually had corn in Europe 7,000 years ago. Not that it matters anyway, the hobbits seem to be another anachronism, Victorians somehow living in the midst of an ancient Norse saga.
I have to say that I never thought about it before now. I guess since I watched the movie after reading the book, listening to the BBC radio version, it never stood out to me. I hadn't thought about how it would look to those who have no or little background with LOTR. I'll have to watch that again with that in mind.