The story
By a metaphor with literal bookkeeping that evokes (1) a mental echo of the double-entry method thereof and (2) the notion of keeping two sets of books as a way to cover up the truth (i.e., by a different figure of speech, to cook the books).
Etymology from Wiktionary, CC BY-SA 4.0.