Writers do make something from a library sale, of course. If a writer has a copy or two of their book in each library, that's a nice quantity...even if it does reduced direct to the public sales.
Used book shops had local clientele at one time. Now through the internet a small store can ship titles anywhere. Web site where they can list inventory broadens their base of customers.
I just bought four of Barbara's older titles for a song and she did not profit from the sale at all... save when the books were originally bought.
An internet purchase might be as problemsome as an MP3 file. Stephen King's attempt at selling an internet story did not provide a greater profit than it might have conventionally. He discontinued the effort. I am not sure how the "bugs" would be worked out of the system, but with paper that can only age over time... the best way to preserve text is as stored data.