Authors came, and often brought books to sell as mementos. Thus a major market was born, as publishers came to realize that in-school appearances presented a phenomenal opportunity to promote and sell books. I have heard of author visits where 1,000 to 1,500 books are sold in one to three days. Virtually every publishing house now has a staffer to arrange visits. The kids meet someone who actually earns a living by putting words to paper, and they can explore the art of writing.
Many authors work hard for their fee, spending a day at a school and meeting with many classes.
They may even suffer indignities in the process. In the hilarious Author's Day by Daniel Pinkwater, an author on a school visit is bitten by a bunny, praised for a book that isn't his, and fed a cold, lumpy pancake containing a green crayon. But a successful author is not always a success in the classroom. You want it to be a teaching situation almost, so kids understand why you have to put a period at the end of a sentence. When that happens, the impact on students can last years.