Sadly, Magic effects only take effect when they encounter a valid target.
You'll have to do it the hard way.
If you insist on having a single spell that has a varying magicka/mana cost, you will need to make a separate script to attach to the player, that contains a OnSpellCast(akSpell) event, get the restoration level in that script, and make sure it is a public variable.
In the event block, provide some conditional statements such as:
HarmUndead = akSpell
Float mDmg01 = ;smallcost
Float mDmg02 = ;mediumcost
Float mDmg03 = ;largecost
If rLvl >= 0 && rLvl < 33
Game.GetPlayer().DamageAV("Magicka", (mDmg01))
ElseIf rLvl >= 33 && rLvl < 66
Game.GetPlayer().DamageAV("Magicka", (mDmg02))
Else
Game.GetPlayer().DamageAV("Magicka", (mDmg02))
EndIf
Just an example, but if you know how to handle conditional statements, you can get quite creative with it.
The downside of doing it this way is that if you make the spell cost zero to accommodate these scripts, it will show that spell has a 0 cost, but the script will see otherwise.
Otherwise, you could just make each instance of the spell like BethSoft did, and vary the magicka/mana cost depending on the the equipped spell. I haven't encountered an easier way to achieve this. I ran into this a whole lot in my mod, Tristram In Skyrim.