> Where in the statute does it say this?
Generally speaking, in Section 108:
> (…) under the conditions specified by this section, if—
> (1) the reproduction or distribution is made without any purpose of direct or indirect commercial advantage;
https://www.law.cornell.edu/uscode/text/17/108
If, however, you were the copyright owner and were to (ab)use a library as a copy shop, the entire section does not apply, since it's about a special (but limited) exemption from copyright regulations for library copies. (The section starts with, "Except as otherwise provided in this title and notwithstanding the provisions of section 106, it is not an infringement of copyright for a library or archives, or any of its employees acting within the scope of their employment, to reproduce…") Mind that this is not about the use of library hardware, its's about a legal framework for libraries to provide copies of copyrighted material to library users.
(Still, you may encounter other difficulties, like the library deciding that they are not a copy shop, or that they won't exceed the legal limit of 3 copies as provided under Section 108 anyways, which wouldn't work out that great for producing a pamphlet… Maybe, there's a statute for this, but this is another topic.)