I agree with both posters that 1) it isn't entirely clear why Napoleon allows Moses to stay and tell stories about the promise of Sugarcandy Mountain. I also agree that the most likely reason is that Sugarcandy Moutain is an opiate: something to pacify the other animals. If they do not have much to look forward to in this world, at least they'll have that great reward in the next. Even if Napoleon is distracted with whiskey and beer, he is even more distracted by power. I don't think Napoleon believed in Sugarcandy Mountain. So, the other reason he may have openly disagreed with Moses, yet let him stay, was because Napoleon did not see him as a threat to his own power. Given the name Moses, I thought (and was wrong) that perhaps Moses would gain some kind of following/power as a religious leader. If the book had been longer, I suppose that Napoleon would have Moses executed as well - unless Clover and the others organized some revolt.
I appreciate the previous editor's comment that indeed Napoleon allows this to go on as a distraction, or perhaps, Napoleon isn't even aware of the extent to which all of this is being discussed as his days of brewing beer and ordering whiskey are becoming more and more frequent. It may be that he has been so affected by his consumption that his true goals and desires are no more and he really could care less as long as he has the power here and now in this world.
Another aspect to consider is that the hope in Sugarcandy Mountain keeps the desire alive in animals to work hard as if their efforts in life earn them something beautiful at the end of a life well lived, something like heaven as most religions purport.
I do not think you actually get a clear answer to this in the book.
In Chapter 9, Moses returns to the farm and starts telling these stories. The pigs talk about how he's telling lies, but they don't try to drive him off.
I think they are allowing him to stay as a way of trying to keep the animals from rebelling. If they believe in the Sugarcandy Mountain, maybe they won't care so much about how bad things are right now on the farm.
So Moses's function is sort of like what slave owners wanted religion to do to their slaves -- keep their minds off their problems here and now so they won't rebel.