During WWII German spies operated in Mexico with the tacit approval of the Mexicans.
There were plenty of spies running around the US when we were still neutral and I don't think we put many resources into catching them in the days before Pearl Harbor.
When Mexico officially entered the war, the spies were apprehended and tried, though there may have been a few who were too big to take down.