German power companies hope to collect up to €6.3 billion ($7.1 billion) plus interest from the federal government, after the country's highest court ruled a tax on nuclear fuel was unconstitutional.

Shares in E.ON (EONGY) rose 4.15% to €8.38, RWE (RWEOY)  gained 3.64% to €19.26 and ENBW was up 4.1% to €22.86 at 11:54 CEST after the Constitutional Court ruled on a technicality that the government has exceeded its powers in levying the tax.

E.ON paid a total of €2.85 billion plus interest, RWE's payments came to €1.7 billion and EnBW €1.4 billion, according to German media.

The tax, which was introduced in December 2010, required nuclear operators to pay €145 per gram of fuel deployed in their reactors. Between 2011 and 2016 it yielded €6.3 billion for the German budget. It was levied every time a fuel rod was changed and in its early years allowed the German government to claim it had balanced the budget for the first time in decades.

The companies had previously also tried to argue the tax was against European Union law, but the European Court of Justice ruled against them in 2015.

However Hamburg court had previously looked at the issue from the point of view of German law and decided to let the supreme constitutional body in Karlsruhe decide.

The tax was originally agreed as a quid pro quo for government approval to extend the life of the country's ageing reactors. But within months the earthquake and tsunami that hit Japan's Fukushima nuclear power plants in 2011 pushed the government into a U-turn and a decision to shut down all nuclear reactors by 2022.

The German companies have also been struggling with the competition from green energy and were last year hit with a demand they pay €23.6 billion into a new state fund for storing nuclear waste. This was much higher than they had anticipated.