# **1 Introduction**

State capacity to raise tax revenue is an important enabler of development (Besley and Persson, 2009). Poorer countries mobilize less tax revenue as a share of GDP (Gordon and Li, 2009) and suffer higher levels of corruption. While tax evasion and weak bureaucratic performance are salient drivers of the differences in revenue mobilization across the development spectrum (Finan et al., 2017, Khan et al., 2015, Khan et al., 2019), less is known about who evades (how much), and to what extent evasion is facilitated by (which) bureaucrats. Evidence on the effectiveness of reforms to remedy systemic corruption is also scant. This paper presents a new methodology to detect and quantify the prevalence and costs of a type of corruption scheme in customs, and assesses the effectiveness of an intervention intended to eliminate such corruption. Across the globe, customs information technology (IT) systems usually prescribe random assignment of incoming declarations to inspectors, conditional on their productivity (in the task of clearing declarations), as a way to deter corruption. Our approach identifies potential manipulation of inspector assignment by evaluating whether certain inspectors are paired excessively frequently with certain customs brokers, deviating from what conditional random assignment would predict. To assess whether these deviations reflect corruption, we subsequently examine whether excess interaction between inspectors and brokers is associated with an increased risk of tax evasion and whether deviant declarations are treated preferentially by inspectors. We quantify the resulting tax revenue losses and their distribution across inspectors and brokers. The methodology is validated by studying the impact of an intervention that delegates the (randomization of) inspector assignment to a third party organization external to customs.

We apply our approach to Madagascar’s main port, Toamasina, which provides a suitable setting for studying corruption in customs. First, like many other developing countries, Madagascar is heavily reliant on tax revenues collected at the border (Baunsgaard and Keen, 2010), which account for 48 percent of total tax revenues. Toamasina collects more than three quarters (78 percent) of non-oil tax revenues and employs a limited number of inspectors. Each inspector oversees the collection of 1.3 percent of total yearly taxes in Madagascar. Second, corruption appears rife in customs. A survey of inspectors reveals that only 6 percent believe non-ethical conduct is sanctioned, and only 23 percent believe their colleagues act with integrity. Third, inspectors repeatedly interact with a limited number of brokers, with whom they also share social ties. The combination of high stakes, a small number of players, limited sanctions for improper conduct and extensive repeated interactions is conducive to corruption. Last but not least, Madagascar’s senior customs management were willing to undertake reforms to curb corruption and provided us unprecedented data access. They shared data for the period 2015-2018 covering rich details on each import declaration including declared value and weight, weight measured upon arrival at the port, taxes paid, the identity of the broker which registered it and the inspector assigned to it, whether fraud was recorded, all revisions to inspector assignment, value, weight, and tax liability made during the clearance process, as well as risk 1