Uddevalla district court in western Sweden dismissed all charges against the two men on Friday morning, and awarded them compensation from public funds.
The prosecution alleged that the two men had participated in crimes that consisted of transporting garlic between Norway and Sweden on 59 occasions, without notifying the Swedish customs authority.
The total weight of the garlic in question, which the prosecution claimed was moved between 2009 and 2010, was said to have been 1287 tonnes.
The prosecutor had alleged that the garlic was brought into Sweden via Norway in order to avoid paying EU import duties to a sum of 2.6 million euros ($2.87 million), which it said should have been reported to the Swedish state.
The court concluded however that the prosecution could not prove that more than one transportation of garlic had crossed the Swedish-Norwegian border, nor could it prove that more than one was subject to customs offences.
It also judged that it had not been proved that the defendants were involved in the one occasion that an offence took place.