Endogenous the world of the story is self-contained, with no reference to the real one.
The Hobbit/Lord of the Rings*
Elric of Melniboné
The Dragonriders of Pern/Harper Hall Trilogy**
Exogenous fantasies are ones in which there is communication and travel between fantastic worlds and the “real” one. This category has three sub-types.
2A. The first, most common type, is when characters from a contemporary or historical reality somehow travel to a fantastic world (which may or may not be a dream/hallucination.) Travel between the worlds usually requires some kind of traumatic event or magic, or just singing the Imagination Song.
Alice In Wonderland
Wizard of Oz
Chronicles of Narnia
The Door Into Summer
The Compleat Enchanter
Chronicles of Thomas Covenant
Harry Potter (a bit of an edge case, since there is far more intermingling between the real and fantasy worlds than in the other books in this category)
South Park: Imaginationland*****
This exogenous sub-type seems to be the most common, perhaps because it’s easier to introduce a fantastic world through the eyes of someone from ours. Endogenous fantasies such as The Hobbit, Lord of the Rings and Belgariad compensate for this problem by beginning with a setting that is very familiar–the Shire is an idealized version of the English countryside, while Garion begins his childhood as a kitchen boy on a family farm with nothing fantastic about it. Even Star Wars does this to an extent, though by that point the trope is familiar enough that its use in Star Wars is subverted (he’s a young man on a farm, but it’s . Books about time travel like HG Wells’s The Time Machine and Mark Twain’s A Connecticut Yankee In King Arthur’s Court) arguably belong in this category as well.
2B. less commonly, the fantasy world is first presented as self-contained, but then characters from there visit the “real world.”
Xanth series characters from Xanth sometimes end up in the real world, which they call Mundania, presented in a wonderfully defamiliarized way as a place which alternates between dreariness and terror.
His Dark Materials
2C. Finally, the third sub-type is when fantastic elements invade the real world, causing mysterious events and uproar. Usually but not always, the story is told from the point of view of a character investigating or interacting with the fantastic beings/creatures/forces.
The Master & Margarita
Nearly all horror stories about the supernatural fit this category. This type could be expanded to include stories in which fantastic elements co-exist with the real world, usually in hiding, or in an out-of-the-way location. In that case books like Watership Down and The Mists of Avalon would be included, and Harry Potter and Lost could be moved here from 2A.
* JRR Tolkien presented the Lord of the Rings as being a history of a pre-historical civilization, but this is only hinted at in the appendices, and thus to most readers, the world appears to have no connection to ours.
** technically science fiction, and later a connection to a future Earth is revealed, but in the original, superior books, it feels more like fantasy and Earth is barely a legend.
*** also ostensibly science fiction, but with fantasy elements, and given that is set in a galaxy that is far away and a long time ago, no connection to the future of Earth or the human race seems to be intended.
**** the “real world”, though, is a world of science fiction in Earth’s far future, not contemporary or historical reality.
****** although it begins with a fantastic being (a leprechaun) blundering into South Park. This is actually fairly common in type 2A fantasies, in that there is often some kind of foreshadowing or linkage between the worlds presented before the characters make the leap into the fantasy world. For example, in the movie Wizard of Oz, Dorothy meets people in Kansas who are played by the same actors as the characters she meets later in Oz. Another is when Thomas Covenant meets a mysterious beggar who may or may not be the creator of The Land.