Amazon has agreed to a $2.5bn settlement with the Federal Trade Commission over allegations it tricked customers into signing up for Prime membership.