Amazon has agreed to a massive $2.5 billion settlement with the Federal Trade Commission over charges that it knowingly trapped customers into paying for Prime subscriptions, the agency announced Thursday.