Possession of The Anarchist Cookbook has been used as evidence against terrorist suspects in Britain, and also as a crime itself, "Possession of terrorist material". In the latter case, the 17 year old's argument was pretty much what you suggest, and he was cleared.
They have access to library records because of that scenario. They would be able to access online bookstore records.
The book may not have been purchased of course, or may have been banned for sale in a country - many illegal copies of books were made in Communist states in the 80s for that reason.