These fantasy epics are presented in-universe as chronicles recorded by their protagonists. The main characters of the two stories, Bilbo Baggins and his nephew Frodo, respectively, tell their people of their adventures in the wider world. Both also show an affinity for words in general, solving riddles to help them advance on their respective quests. Bilbo, Frodo, and others also compose poems and songs within the pages of the stories, as poetry and storytelling are held in high regard in this world.
Tolkien, the (real) author of these books, drew on a lot of old tales when crafting his novel. He also invested a lot of energy into his conlangs (constructed languages), as linguistics was also a passion of his. These fantasy novels are beloved for many reasons, and one is the way that they celebrate stories, storytelling, and language.