J.R.R. Tolkien created huge heaping treasures of magic items, piled them up, and set dragons to guard them. He raised entire cities around groups of Elven and Dwarven craftsmen who minted, built, constructed, manufactured, conjured, or otherwise produced factory-style volumes of magical cloaks, lanterns, musical instruments, weapons, armor, and maybe even shoes. You cannot find a story about Middle-earth where Tolkien doesn’tdoesn't have someone do something magical. He has sleep spells, disease spells, spells of far-sightednessfarsightedness, curses, counter-curses, healing magic, and Elves can run on snow.
Despite this it seems valid to still ask "why isn't gunpowder more common", but there needn't be a significant reason for this. The ancient Chinese had gunpowder, fireworks and blasting devices, but yet it wasn't hugely common there either - it was invented entirely by accident, required specialisedspecialized alchemical knowledge, handling of volatile and dangerous ingredients, and it'sits use as a weapon was a later development.
and so to the Machine (or Magic). By the last I intend all use of external plans or devices (apparatus) instead of development of the inherent inner powers or talents — or even the use of these talents with the corrupted motive of dominating: bulldozing the real world, or coercing other wills. The Machine is our more obvious modern form though more closely related to Magic than is usually recognisedrecognized.