Welfare Economics with Intransitive Revealed Preferences: A Theory of the Endowment Effect