A +5 enhancement to a shield-as-armor costs 5² × 1,000 gp = 25,000 gp, not 40,000 gp.
A +5 enhancement to a shield-as-weapon costs 5² × 2,000 gp = 50,000 gp, not 80,000 gp.
I have no idea where you got 40,000 gp and 80,000 gp from, but they are incorrect.
Anyway, both of these kinds of enhancements can be applied to a shield:
An enhancement bonus on a shield does not improve the effectiveness of a shield bash made with it, but the shield can be made into a magic weapon in its own right.
Unfortunately, aside from the statement that it can be done, we have no rules for how it actually works—which is to say, we don’t get explicit rules telling us how much it costs.
For instance, does the shield have to be a masterwork weapon as well as a masterwork shield? That would cost 300 gp, but it’s not clear if it’s necessary.
Furthermore, combining magical enhancements together can—in the context of worn magic items using body slots, not in the context of a held item like a shield—cost 50% of the lesser-valued cost extra. Does that apply here? RAW, no, but a lot of people suspect that it maybe is supposed to.
There just aren’t answers to these questions to be had.
But for my money—and I do know a lot about this system—the answer is simply “price a magic shield and a magic weapon independently of one another, and pay both costs—those payments just happen to be going towards one item that does both things rather than two separate items.” So, say, a +5 heavy steel shield that is also a +5 shield-bash costs
20 gp [base cost of a heavy steel shield]
+ 150 gp [mwk. armor] + 25,000 gp [+5 armor]
+ 300 gp [mwk. weapon] + 50,000 gp [+5 weapon]
= 75,470 gp
You can avoid all of the uncertainty behind this—and get a damage boost, to boot—by using 10-gp shield spikes. Then you clearly spend 20 gp + 150 gp + 25,000 gp = 25,170 gp for your +5 heavy steel shield and 10 gp + 300 gp + 50,000 gp = 50,310 gp for your +5 shield spikes as separate items that happen to live together on the same physical object (that is worth 75,480 gp). My above calculation assumes that things for the un-spiked version should be the same, just without the 10 gp for the shield spikes themselves.