Stop right there.
Piracy and checking a book out from a library sounds the same to you, because to you, there is no difference. Either way, you’re not paying.
But there is a HUGE difference. Because when you pirate a book, the author gets NOTHING. The value of books go down to the publisher, resulting in fewer books produced and smaller advances for authors. Piracy actively hurts the sales of books. Yes—there are some people who pirate books and then go on to purchase books. Yes—there is an argument to be made that people discover books via piracy, leading to more sales. But for the vast majority of authors, piracy hurts everyone in the business—there is no statistical data that I know of that disproves this. Anecdotal evidence based on that one guy who buys a copy of every book he downloads doesn’t count.
Libraries? Libraries HELP everyone in the business. A library sale is significant and directly supports the authors and publishers who make the books. If a book you want isn’t in the library, requesting it leads to a sale. If it is, checking it out leads to more future sales for the author. A library sale leads to more than just profit—it leads to exposure in significant awards markets, promotion for the author in trade show and librarian market shows, and much more. Library books are free for you to check out, but not free for the library to purchase—so when you check out a book, you’re contributing to the purchase of the book, to money in an author’s pocket. The more a book is checked out, the more an author gets—books have to be replaced, and check-out date contributes to future advances and sales for the author. Every book checked out from a library supports authors, supports publishers—and what’s more, it also supports libraries and the communities—the people inside those communities. More library activity = more tax money to support the library = more community involvement in the library = greater educational opportunities throughout the community.
To you, it’s a free book. Maybe it doesn’t feel different how you procure the book. But piracy at best gives an author exposure and at worst actively hurts the exact people who are trying to make the very books you’re stealing. Libraries actively work to support authors and the very community you live in.
Saying that piracy is equal to libraries is the same as saying that you don’t care how other people are affected if the end result is the same to you.