Institutional quality and capital inflows: Theory and evidence