The authors study optimal capital income taxation in heterogeneous agent economies featuring endogenous government spending. Similar to Aiyagari (1995), they find that the long-run optimal capital tax rate should not be zero as long as the competitive equilibrium risk-free interest rate differs from the subjective time discount rate. The authors first argue that this result holds in a wide range of economic environments and is not limited to only the standard incomplete market model with heterogeneous agents. As an example, a decentralized economy with limited commitment is considered. Second, they show that this result critically depends on the assumption of endogenous government spending. Within the same limited commitment environment, they show that the long-run capital taxation becomes zero with exogenous government spending. The authors conclude that the optimal Ramsey taxation in heterogeneous agent economies with exogenous government spending and various frictions is still an open question.