And the first-sale doctrine is why libraries are legal. (I imagine that book publishers once waged an MPAA-style war against libraries.) But libraries really have nothing to do with P2P piracy.
That's not the same as building a publishing operation and creating new copies of the items in their catalog for anyone who wants one. Lending doesn't create new copies.
Personally, I think IP is nonsense, but a lot of people disagree with me.