This is a common, but very frustrating misconception. As Dramamamma said, the book doesn't just refer to the dialogue, it also refers to the structure, the storyline, the character development, the themes, etc. It can even refer to the strategic placement of songs within the story. When it comes to a sung-through musical, the book-writer (usually also doubling as the lyricist) still has to do all of that dramaturgical work, even without writing dialogue. To use Hamilton as an example: Lin made a lot of those decisions, like which major events in Hamilton's life to emphasize, who narrates the show show and when, which historical figures were included and which were excluded, which themes to highlight in Hamilton's story, and so on, and so forth. All of these are the decisions of a book writer. So when he won the Tony for Best Book, it was these decisions that they were awarding.
This is such a common misconception that Charles Isherwood (the second-string critic for the NYTimes at the time) made a comment about Hamilton not having a book. Isherwood was (is) a total hack, so it's not surprising that he would make a mistake like this. But the fact that a major critic from the NYT made this mistake demonstrates how widespread it is.