I don't understand how it's bad to pirate a book, but fine to freely give one away. Both deprive the author of a sale. Either they should both be allowed or both be prohibited.
Both of them do potentially deprive the creator of a sale, but they keep the same total number of things in circulation.
Sure, you can argue that philosophically it comes to the same thing, but the problem is that, if you win that argument, the powers that be are more likely to ban giving away things you own than they are to allow piracy...