Maybe not "the same," but not because of creature size
There are many different kinds of magic in the world of DnD: divine, arcane, psionic, innate, etc. But when it comes to a creature's spellcasting (when not done through a magical item or other external means), there's a common theme: a spell's power and precision are bolstered by the heart and mind, not the body.
Every creature in the Monster Manual, and class or race in the Player's Handbook that can cast spells does so with a spellcasting ability of Charisma, Wisdom, or Intelligence. None of these are Abilities which are guaranteed to increase with size (a Tarrasque has between a +0 and a -4 in each of them). But they do tend to vary from one creature to another. Some dragons are far more charismatic than others by default (Gold dragons especially), and pixies tend to be more intelligent than white dragons, as a rule.
Likewise, a creature's proficiency bonus, which is essential in determining both its spell save DC and its spell attack modifier, does not necessarily correspond perfectly with its class level. For example, a Drow Mage (MM p. 129) is a "10th-level spellcaster," but seems to have a proficiency bonus of +3. A 10th level adventurer (player character) would have a proficiency bonus of +4. Proficiency bonus is also not reliably related to size: an Awakened Tree is a Huge creature, but only has a proficiency bonus of +2 (MM, p. 317).
All of this means that a spell may be "more" or "less" powerful when it is cast by two different creatures, even if they have the same spellcaster class and level: but only because the saving throws will be more difficult to pass, or the spell will be more likely to hit. And these differences will not be directly related to the size of the creature casting the spell.