It is from Hard Times, but no-one actually says it. It forms part of the author's narrative.
The speaker and the schoolmaster, and the third grown person present, all backed a little, and swept with their eyes the inclined plane of little vessels then and there arranged in order, ready to have imperial gallons of facts poured into them until they were full to the brim.
Also, Mr Gradgrind is not a schoolteacher. He's a wealthy businessman and benefactor to the school.
Lol! Doesn't he just. Doesn't get him anywhere though. Actually your answer is a fairly common misconception - you're not the first to come back with it.
The schoolmaster, by the way, is Mr M'Choakumchild. Hmmm. Sounds like good advice. ;-)