But, for a proper answer, I´ll say there had to be methods to know, like scanning the ship and its occupants, comparing weight before and after the trip, monitoring the traders´ bank accounts and purchases, hell, maybe they even frisked them on return.
All of these only show what the merchant exported and chose to bring back to Foundation. They do NOT show what the merchant earned so long as he invests - or consumes - part of his earnings outside Foundation and chooses to not report or underreport it.
Based on their advanced tech and their penchant for secrecy, it´s not far-fetched to say they were control-freaks, and most definitely capable of finding out a trader´s profits if they so chose to. I mean, today, with our limited tech, the government can find out your earnings and if you´ve been getting something on the side easily. How much easier would it be for Foundation? Tax people have always and will always be the most thorough hounds. Give them high-end super computers and a paranoid government and they´ll be infallible lol.
Foundation tax people did not have high-end super computers. And more importantly, they did not have control of the various governments of Periphery.
Mallow suggests Commdor to set up "fictitious corporations" to conceal the profits of his necklace trade from Korellian public opinion. Well, Korellian public opinion was everywhere on Korell. Foundation´s tax agents were not. If Mallow chose to spend some of his earnings on Korell, or invest them, and not report them to Foundation tax office, was Korell going to inform Foundation?
Like, Mallow sells a necklace to Commdor for 1000 credits, which Commdor resells for at least 10 000 - but then Mallow reports to Foundation tax office that he sold the necklace for 500 credits. And these 500 credits never reach Foundation, because Mallow spends them all on Korell.
Or alternatively, Commdor pays Mallow 1000 cash, which Mallow correctly reports - but what Mallow chooses to not report is
Hober Mallow said:
Nor was there any mention of what I had for breakfast that day, or the name of my current mistress, or any other irrelevant detail
... like the irrelevant detail that the breakfast was free, paid from treasure-chest of Commdor, on top of the 1000 credits cash that Mallow declared, and the mistress also was free and also paid (along with the baby Hober made) by Commdor also as a part of the 10 000 credits deal?
Foundation didn´t want contact with the Empire, that´s a fact, otherwise the Empire would´ve known of their existence without having to investigate. And Foundation could´ve enforced this secrecy with very strict controls on returning trading ships, tracking their routes even, maybe threatening with jail time or fines. Once again, Asimov doesn´t mention this, but it is a very plausible explanation.
But later on we see that Foundation was NOT very good at enforcing their laws on the merchants. The existence of Society of Independent Merchants, by the time of Devers, is a demonstration. Devers had not broken with Foundation - Forell was able to employ him. By the time of Mule, Independent Merchants had been able to build a navy to match Foundation - Foundation of Indburs was unable to stop that.
The whole story of Independent Merchants shows that Foundation COULDN´T enforce policies against Traders which were too easy and profitable to evade.