German investigators suspect that a mole spied for Swiss intelligence from inside a government office which was trying to catch German tax dodgers.
The allegations are part of the case against an alleged Swiss spy arrested in a Frankfurt hotel on Friday, German media report. He is suspected of monitoring German tax investigators.
Switzerland objects to the practice of buying data stolen from Swiss banks.
The mole allegedly spied inside North Rhine-Westphalia's finance ministry.
Investigators suspect that the mole - not yet identified - gave the Swiss spy the names of tax investigators, and that the Swiss Federal Intelligence Service (FIS) ran the operation.
Since 2010 North Rhine-Westphalia (NRW), Germany's most populous state, has paid whistleblowers millions of euros for data CDs revealing secret Swiss bank accounts. They are trying to recover millions of euros hidden by German tax dodgers.
It is thought the alleged Swiss spy had a list of German investigators, provided by the FIS, and used his secret ministerial informer to verify those names.
That intelligence could then be used to accuse specific German officials of violating Swiss banking laws and engaging in commercial espionage.
NRW Finance Minister Norbert Walter-Borjans voiced alarm (text in German) over the latest revelations.
"The scandal reaches new proportions when spies sign up informers in the finance administration, in order to spy on successful NRW tax investigators and play into the hands of people who make billions in profit at the expense of society," he said.
"It's hard to believe that such a spy thriller took place not on the screen but on our own doorstep."
The German federal government has asked Switzerland for an explanation concerning the alleged spying.
The arrest warrant for the 54-year-old, named only as Daniel M, was issued in December.
The warrant, cited by German media, alleges that the acting FIS chief was in mobile phone contact with Daniel M. The FIS is said to have paid €90,000 (£76,300; $98,380) for planting the mole.
Reports say the alleged spy was also helped by a German ex-police officer, who is now a security consultant.
In recent years the Swiss government has moved to make its banks more transparent. It signed a tax transparency agreement with the EU in 2015.
Billions of missing euros
The Swiss man arrested on Friday is suspected of having spied in North Rhine-Westphalia since early 2012.
Police searched several residential and business premises in Frankfurt and the nearby Wetterau region.
German authorities say they are owed tens of billions of euros in unpaid capital gains tax because of money hidden in Switzerland and other tax havens.
On Tuesday the FIS defended its efforts to prevent the theft of Swiss business secrets, but declined to comment directly on the Frankfurt arrest.
FIS director Markus Seiler said "when someone in Switzerland uses illegal methods in Switzerland to steal state or business secrets, that is espionage, and we have the task to fight that".
North Rhine-Westphalia has bought 11 CDs in the tax recovery operation, which it says have led 120,000 German citizens to self-report Swiss bank accounts.
A year ago Mr Walter-Borjans said about €18m had been recovered using the data found on the CDs.
In 2015 German media reported that €5m had been paid for just one of those CDs.