In this paper, we present an agent-based model in which taxpayers 'live' in a network and care about their social reputation. Individuals decide whether to pay or to evade taxes considering the expected economic net benefit and the reputational cost from tax evasion. Individuals differ in income and in the weight they attach to social reputation, which is updated by assessing the opinions shared in their reference group. The reference group contains individuals irrespective of their income (integrated society) or it is made up of peers belonging to the same income group (segregated society). We simulate the model in the two alternative settings to find the frequency distribution of taxpayers in a dataset of random networks. The results indicate that, in an integrated society, network conformity is reached and all individuals either evade or pay their taxes. Conversely, a segregated society might generate obstacles to the diffusion of opinions and, as a result, tax evasion and tax compliance might coexist. Lastly, we consider the effects of a social media campaign starring a celebrity financed by a fiscal authority to increase overall tax compliance by exploiting the diffusion dynamics in the network. We show that such a policy is more effective if the diffusion of opinions is not hindered by social segregation.