That line isn't in the book, if I remember correctly. The closest thing to it is a short snippet in UNFISIHED TALES (the essay "The Hunt For The Ring", part iii), where Gandalf and Saruman argue at a meeting of the White Council (a hundred years or so before THE HOBBIT). Saruman is trying to dissuade the Council from okaying Gandalf's plan to attack Dol Guldur (which he suspects to be Sauron's summer home). Gandalf smokes his pipe, which annoys Saruman. He rips in to Gandalf: "When weighty matters are in debate, Mithrandir, I wonder little that you should play with your toys of fire and smoke, while others are in earnest speech."
Gandalf came back: "You should not wonder, if you used the herb yourself. You might find that the smoke blown out clears the mind of shadows within. Anyway, it gives patience, to listen to error without anger. But it is not one of my toys. It is an art of the Little People away in the West; merry and worthy folk, though not of much account, perhaps, in your high policies."
Saruman gives Gandalf a ration of cold disdain. Gandalf blows a bunch of smoke rings at him, but when Saruman tries to grasp them, they dissipate in his grasp. (Get it? GET IT??)
I think that pipeweed is just tobacco (would a fusty Oxford prof know about marijuana and cite it approvingly in the early 1950s?)
Although it would explain why Hobbits were always so hungry...