Animal Farm by George Orwell is an example of a highly successful fictional novel that was a political allegory for the Russian Revolution and Stalinism. The combined fable and political satire is often included in American high school curriculums because it offers a simplified explanation of the basic principles of Stalinism and the animalistic nature of mob mentality. Similarly, he wrote another novel titled 1984, which focuses on a fictional account of a dystopian society in which freedom of speech and expression is strictly curtailed and citizens are indoctrinated by oppressive propaganda. Orwell was inspired to write 1984 after watching totalitarian dictators such as Adolf Hitler and Joseph Stalin rise to power throughout Europe in the 1940s and wrote the novel to show readers what could potentially occur if they allowed their governments to dictate how their citizens think and behave. The end result would be mass surveillance, indoctrination, and manipulation. By writing fictional novels, rather than political essays, Orwell was able to contextualize and express his beliefs in a manner that was engaging, attention-grabbing, and accessible to a wide audience of average Americans who wouldn't have been interested in, or able to understand, political jargon. In this case, the medium of a fiction novel was perfect for spreading Orwell's particular belief system.
In addition, literature is always subjective, and some individuals might have different opinions on what the purpose of literature is. There is no general consensus that it must be used purely for entertainment purposes.