When Harry is looking into the Pensieve, he sees a modified memory of Horace Slughorn. Tom Riddle was visiting Slughorn and provided some snacks for him. (IIRC, it was candied pineapple, which was one of Slughorn's favorites.) A little later after the other students leave, Tom starts asking about Horcruxes. I don't recall J K Rowling saying directly that Tom set up Slughorn to answer any question he wanted, but I could imagine young Tom improving the odds of getting what he wanted by slipping a little truth serum into the food.
Why would Slughorn eat food provided by somebody else?
Somebody could slip anything into the food. Not just a little truth serum. Or poison. Or a love potion. Or a nip of polyjuice. Or Gandalf only knows what else.
We know some people only eat food they prepared (e.g. - Mad Eye Moody), and that Slughorn was a cautious man, so you think he'd wouldn't take a bite out of any food anybody else provided.