We consider the interplay between income distribution and optimal commodity taxation, linking equity issues to optimal taxes through the effect of income distribution on market demand and its price elasticity. We find conditions to conciliate the equity and efficiency tradeoff and to assess the impact of inequality changes on the optimal taxation of necessity and luxury goods. We show that the regressivity or progressivity of the tax system is determined by the distribution of luxuries and necessities in the economy. If the tax system is regressive (progressive), a decrease (increase) of income inequality leads to an average decrease of the optimal tax rates, achieving welfare gains for society. Our analysis provides a framework to investigate the linkages between direct and indirect taxation.