Why did the Germans (and Allies for that matter) not devote more energy to the mining of enemy controlled waters (in the Med, British and North American waters for the Germans and Med, Baltic and Norweigan waters for the Western Allies)?
Mines, like most other passive defense systems, have a limited utility. Mines don't stay in one spot, as storms and currents move them, sometimes into your own areas. Mines fail as sea-water corrodes them. You have to place them in huge areas yet a narrow swept lane negates nearly all of their usefulness.
So unless you already control the seas, your mines will be negated. If you do control the sea, then mines are something of a danger to you!
Subs are more expensive, but can move into contested waters and hunt the enemy. They can be moved from place to place, and keep their weapons in order until needed. If the battleground moves, they can move with it.
This is two different questions:
What if Germany as diverted the resources wasted in the U-boat campaign (or at least half) to saturation mining of the Med and British waters?
Kind of a judgemental question, but it is true that more mining might have been effective. The Mediterranean was heavily mined during the war. In general ships had to take very specific routes cleared by minesweepers and constantly patrolled.
Subs could not get into the Mediterranean because of the blockade at Gibraltar. Also, even if you got a sub into the Mediterranean, it was problematic because there were so many mines everywhere. The British could not operate subs in the Mediterranean because of mines.
The coast around Britain was a similar story. It was very heavily patrolled and sea lanes were protected around the clock by minesweepers and destroyers. If the Germans had developed mobile mines or more advanced methods of mine laying it might have had a beneficial effect, but it would have been complex, expensive and time consuming to alter their basic strategy in this way. If the Germans could have established air superiority over all of Britain, it would have been lights out because among other things, that would have allowed them to mine the sea lanes, but that never happened.
Why didn't the RN [Royal Navy] mine the Norwegian coast to stop iron shipments from Sweden to the Reich?
They did attempt to do this in Operation Wilfred which attempted to neutralize the port of Narvik. The invasion of Norway by the Germans prevented this operation from being effective. Even if the mining could have been accomplished, ore could have been diverted through Lulea. Other mines in Sweden were in places which could ship to Germany through German-controlled waters.