WizarDru has covered much of what I have to say on the subject, but let me add that as far as I am concerned, the standard RPG fantasy campaign is not Medieval, it is Renaisance. I don't read a lot of fantasy fiction, but I suspect that that's where you need to turn for answers. Adventure fiction arose at a time when guns were common, and often reflected this fact. But during the rise of the pulps during the early years of the 20th century, sword-and-sorcery type stories arose as a distinct genre with its own rules and reader expectations. It didn't happen because somebody wrote the rules down, and I'd probably have to trot out the meme theory to account for it, but there it is. The best account of these rules I have ever seen comes from
The Tough Guide to Fantasy Land by Diana Wynne Jones -- on the conceit that it's a guide for tourists visiting a fantasy realm. It should be read by all fans of the genre and also of RPGs. Here's a sample entry:
Mountains are always high and mostly snow-capped. There seems to have been no ice age in Fantasyland, so the Mountains rise tens of thousands of feet into pointed, jagged peaks (Official Management Term), which have evidently never suffered erosion. They are full of rocky defiles (OMT) and paths so steep you have to dismount and lead the Horses. Almost certainly there will be at some stage a ledge along a cliff that is only a few feet wide with an immense drop on the other side. This will be covered with ice. Snow will be sweeping across it. The Rule is that you are always in a hurry at this stage.
Again, I'm not an authority on the genre, but I think you can find most definitive elements in Tolkien and Robert E. Howard -- it's amazing how much of D&D already seems to be present in the Conan stories back in the 30's. Firearms were fairly standard in adventure fiction, from The Three Musketeers to Alan Quartermain, yet a genre broke away that even to this day shows a deep-seeded antipathy toward modernism, and modern technology in particular. It wasn't nostalgia for the middle ages in Europe. Nobody objected to anachronisms like tobacco, tomatoes or potatoes. Medieval Europe was defined by the heavy influence of The Catholic Church, but fantasy fans don't expect to see any of that -- they expect anthropomorphic pantheons. So, why is modern weaponry a deal-breaker?
World War I.
What I'm calling Modern Weaponry is actually pre-Modern. But it's useful to note that people associate certain kinds of weapons with modernity. Matchlock rifles were being used for millitary purposes by the 1400's, and the cannon before that. Bombs and incendiary devices have also long been available. However, these were put to unprecedented use in World War I. More importantly, it was fought by a whole generation of young men who were at least two generations away from the last serious war. They've been hearing about the glory of war all their lives. They ship out expecting a safari of some kind and then they were told to dig trenches in the dirt where they would sit for months while if they were lucky they would live to see their friends torn apart by shrapnel, endure the constant whistles and explosions of artillery shells, listen to the screams of soldiers who could take weeks to die in wracking pain from mustard gas-- bleeding inside and out, yellow blisters bubbling up all over their skin, their eyes sealing shut with crust, their throats slowly closing until one day they can't breathe at all -- and a whole generation collectively said "This is the Glory of War?"
So, a new genre of fiction arose -- one in which those weapons percieved as modern, whether they were genuinely modern or not, were banished. War was always horrible, of course, but by taking modernity out of the equation people could still escape into the fantasy of the glorious battle won by the mettle of its combatants instead of by the grim attrition of artillery.
These days, anybody who's forgotten about the horrors of war can simply look it up on the internet, and a lot of people are beginnig to question this banishment of anything that smells of modern weaponry in a genre that happily admits medieval feudalism alongside enlightened despotism, colonial or merchantile goods such as silks or spices in a pre-colonial or pre-merchantile world, post-modern convivial attitudes toward other races right along with races much more divergent than the racial divisions that have caused such strife in the real world, keenly up-to-date ecofeminist attitudes toward nature, and physicians who are remarkably prescient about the medicinal value of, say, moldy bread over that of bleeding by leeches.
The endurance of the fantasy genre is that it represents a flight away from modernism. While there is some utopian science fiction that also represents a flight from modernism, science fiction, especially what they call Cyberpunk, is often a kind of discourse on how bad modernism could get if things continue as they have been. The established fandom for fantasy has inherited, unconsciously, the genre's grudge against the modern world and yearning for a golden past that never existed.