The Justice Department is investigating whether the nation’s largest credit ratings agency, Standard & Poor’s, improperly rated dozens of mortgage securities in the years leading up to the financial crisis, according to two people interviewed by the government and another briefed on such interviews.