Because it’s a copy. It’s literally that simple.
Libraries can operate because of first sale doctrine. You can do almost whatever you want with a physical object that contains a copyrighted work.
What you can’t do is copy it. There is no possible legal way to distribute a digital copy of a work without an explicit license from the copyright holder. There isn’t even a legal concept of “owning” a digital copy. You purchase a license.