Creating an item that gives you proficiency in Use Magic Device is probably the cheapest way to get what you want.
Listed in the DMG and here on the SRD are guidelines you can use to create magic items that don't fit the norm of items you can find in the Magic items compendium or the like.
The cost to create a Magic item of Use Magic Device is:
Skill Bonus: Bonus squared × 100 gp
If you wanted to succeed 100% of the time to use a wand, 40,000gp for a +20 Bonus.
To be able to use scrolls that you already possessed of up to 9th level without failure using Use Magic Device, You'd need a +34 bonus to pass the decipher check 100% to identify the spell on the scroll 100% of the time, so that'd cost 115,600gp to get on a magic item.
Finally, to cast any known spell that you have a scroll off at Maximum you'd need a +37 Bonus to Use Magic Device, at a maximum caster level of 17. That would cost 136,900gp Total. Specifically though, you specified that the spells must be cast at 20th caster level, so that bumps you up to a +40 necessary modifier at 160,000gp for a 100% success rate.
This would allow you to access spells of any spell list, give you access to any ninth level spell on a spell list, you could cast these spells at caster level 20, and comes in 30,000gp below your budget.
Once you do that, you can use Shapechange to change into a Midgard Dwarf.
Midgard Dwarves get the following ability:
Master Smith (Ex): Midgard dwarves gain Craft Magic Arms and Armor, Craft Wondrous Item, and Forge Ring as bonus feats. They are considered to possess the prerequisites necessary to craft any magic item of those types, even if they do not otherwise meet the requirements or have the ability to cast the necessary spells.
This allows you to create Magic weapons, Armors, Wondrous items, and rings with which you don't have to have the necessary spell prerequisite. Meaning that you can put any spell you can think of on any spell list into a Wondrous item with a usage per day limit and create the item you want for half the cost.
The only barrier is that you have to be an outsider to polymorph into one. This is where the Fiendform Spell from the Spell compendium comes in. With Fiendform you become an outsider, which allows you to Shapechange into another outsider for a longer duration. You could use this to change into an Efreeti to grant your party three wishes a day, you can make any magic item you want as a Midgard Dwarf to gain access to UMD, or you can find any specific spell-like ability that a creature can cast and shapechange yourself into that creature to gain access to the spell. (Shapechange is broken)
Midgard Dwarves also get Use Magic Device as a racial skill along with a +4 bonus to UMD, have the following bonuses to their stats: +6 STR +10 CON +4 INT +4 WIS, +3 Natural Armor, 16 SR, and they also get 8 Racial hit die as well as a Bonus +8 to all Craft skills. (See Frostburn for more details)