Wealth redistribution in bubbles and crashes