Moreover, libraries buy book(s) so they can share more copies if there is a demand.
Without authors getting paid for their work there won't be any books at all, except books from those authors who are willing to write them for free of charge. But I assume you don't like online libraries with free books online for some reason.