Yes, which is why nobody is saying "buy second-hand books to support your favorite author".
Also, it's probably a small effect, but I'd guess that the existence of a secondary market contributes to at least some primary sales (since the buyers know they will probably be able to resell a book if they need to, making them more likely to buy a primary copy if they want to read it right now).
Somebody paid for a second-hand copy, nobody paid for a pirated copy.
Incidentally, many favorite books that I pirated when I was broke and had very little room, I later bought paper copies of.
I also pirate most music, but if I really like a band I discovered via piracy, I will buy their vinyl or see them in concert.
The ability to freely share content scondhand, be it a paper book or in digital form, creates new fans. Some of those fans have money to give back, or will share with people that do.