Why "on the books", not "in the books"
Solution 1:
My guess is that this is like "on the list" vs "in the list". You generally append new entries to an account book or ledger (more generally, you edit it). It is not like a book that is written once and for all. The same is true of laws and law books (believe it or not).
When things are added to a list, they are typically put on it (at the end), not in it. This is the same kind of action associated with a log book, an account book, etc. In many respects they are lists.
Even when, as for a law book, you can add entries in the middle or modify existing entries, the general action is updating something that is on the list. IOW, I think it is the list nature that dominates for this kind of "book".
And for on the books you are indeed checking whether something is listed, i.e., is on the list that is the book.
[Of course, a queue is appended to similarly. Yet some people (like me) say wait in line and get in line instead of wait on line and get on line.]