management information (inspection channel, risk scores, and valuation advice).

Our methodology comprises three steps. First, we detect potential manipulation of inspector assignment by identifying pairings of inspectors with brokers that occur much more frequently than would be expected on the basis of conditional random assignment. In Toamasina, 10 percent of all declarations are handled by inspectors whose assignment contravened the random inspector assignment prescribed by official rules. Second, these deviant declarations are shown to have characteristics commonly associated with an elevated risk of tariff evasion and to embody sizeable potential tax revenue losses. Third, we demonstrate that inspectors treat preferentially the declarations registered by brokers with whom they interact excessively frequently ceteris paribus. They clear them faster, are less likely to deem them fraudulent, and impose lower weight, value and tax adjustments, thus exacerbating disparities in tax revenue losses between deviant and non-deviant declarations. These findings are robust to a variety of checks, including the use of inspector-specific binomial logit models to detect deviations from random assignment whilst accounting for fluctuations in inspectors’ schedules, using a propensity score matching approach to account for selection, using different samples and controlling for various sets of fixed effects. According to back-of-the-envelope calculations, average tax revenue per non-randomly assigned declaration would have been 26 percent higher in the absence of excess interaction. Total tax revenues collected in Toamasina would have been 3 percent higher.<sup>1</sup> We argue that these patterns are consistent with a corruption scheme in which brokers bribe staff in the customs information technology (IT) department and/or the customs port manager to be paired with their preferred inspector, who agrees to clear the declarations that are the object of corruption faster, not to impose tax adjustments and penalties, not to insist on upward adjustment (or to request just a marginal one) of the customs declared value. The resulting tax savings are presumably shared with inspectors. Although we do not directly observe bribe payments, our findings are consistent with extensive circumstantial evidence collected during repeated field visits, IT audits, and a survey of customs inspectors. Based on our findings, Madagascar’s customs management sanctioned inspectors for corruption, suspended the head of the IT department and reformed inspector assignment by divesting it to a third party outside customs. This delegated randomization made the third party responsible for inspector assignment. Using its own software the third party randomly assigned declarations. It was so successful in eliminating deviations from random inspector assignment that delegated randomization became standard practice.

Explanations other than corruption are difficult to reconcile with the totality of the observed patterns. They also fail to explain why the delegated randomization intervention virtually eliminated the prevalence of deviations from random inspector assignment. IT manipulation resurfaced after a few months, however, albeit in a different guise. Customs IT staff figured out a new way to manipulate inspector assignment

> 1As discussed in Section 4, our approach does not capture all forms of corruption, hence these estimated losses reflect only the tax revenue losses associated with the specific corruption scheme we document.

2