Yeah, but when it comes to libraries there's a public-good element to their activities, as they provide access to those materials for those who otherwise may not be able to afford them.
In addition, a library, as a source of physical copies, can't lend and re-lend the same content over and over. Which is why, of course, ebook lending programs at libraries are often limited to a certain number of copies... there's an attempt to apply that same restriction to digital content.
Lastly, the lending is always time-limited, unlike digital services.