Sam must have reported the conversation in The Shadow of the Past
As you point out, much of the information you are asking comes only from Gandalf's conversation with Frodo in The Shadow of the Past, so any of it that Merry and Pippin are aware of must have been told to them by Sam.
The Shadow of the Past describes two conversations that Gandalf had with Frodo during that visit, one on the evening that he arrived and another the following morning. Gandalf stays a few weeks after that, but there are no more deep conversations in the text. We know that Gandalf mentions something about the ring in the conversation on the first night, but the important details came in the conversation the next morning which begins with Frodo saying:
‘Last night you began to tell me strange things about my
ring, Gandalf,’ he said. ‘And then you stopped, because you
said that such matters were best left until daylight. Don’t you
think you had better finish now? You say the ring is dangerous,
far more dangerous than I guess. In what way?’
The Lord of the Rings Book 1, Chapter 2: The Shadow of the Past
Gandalf has been absent from the Shire for 9 years before this appearance. It is clear from the start of the morning's conversation that all Gandalf has revealed to Frodo up this point (and that only the previous night) is that there is something strange and troubling about his ring.
All of the information relevant to "the conspiracy" (that the Ring belongs to the Enemy who is searching for it, and that Frodo must leave the Shire and head for Rivendell) is learned by Frodo in the morning conversation. That conversation was overheard by Sam (before he was caught) and must have been reported to Merry and Pippin.
The only way to square this with Merry's statement that you quoted, is to assume that after he was caught, Sam considered himself "on parole" and so did no further spying. He must have convinced himself that it was okay to make a final report to Merry and Pippin of the information he had learned before he stopped spying.
I realise that may seem to be twisting the words a little, but I don't think it can be helped.