The Germans did do it successfully in Holland and France. Englandspiel - WikipediaI wonder if the Germans figured out the existence of the XX program during WW2. On the other hand, if they had, would it have made a difference? If they can't tell if an agent who is sending them information is compromised, when does information supplied get so devalued as to be worthless?
Incidentally, the Germans tried something similar, but they used their intelligence personnel to impersonate captured spies (who had been tortured and killed). Since spies used telegraphy to transmit, the people at the receiving end knew that the information was compromised as people transmitting by Morse have individual styles -- their "fist" -- which is distinguishable by a skilled operator.