Fee-billing snafus at Morgan Stanley and its legacy Smith Barney unit have resulted in a pair of fines for both Citigroup and Morgan Stanley.

The SEC said Friday that Morgan Stanley Smith Barney (MSSB) has agreed to pay a $13 million penalty to settle charges that it overbilled fee-based clients.

In a related action, Citigroup agreed to pay a $1 million fine to end a similar investigation by the state of New York, according to a release Thursday from attorney general Eric Schneiderman.

The SEC alleged that from 2002 to 2016, MSSB overcharged about 149,000 clients by more than $16 million.

Morgan Stanley has reimbursed clients in full, the SEC said, and has agreed to make improvements in its billing practices and record-keeping.

The SEC investigation uncovered 36 different types of billing errors at Morgan Stanley and its legacy firms.

Billing errors at Smith Barney that were carried over into the 2009 Morgan Stanley Smith Barney joint venture resulted in $9.4 million in excess fees through 2015, the SEC said.

Legacy Morgan Stanley errors dating from 2002 produced $6.7 million in overcharges through 2016.

The SEC also alleged that Morgan Stanley, which dropped the Smith Barney name from the merged firms in 2012, violated the SEC’s custody rule pertaining to annual surprise examinations. The agency claimed the firm did not provide its independent public accountant with a complete list of accounts for examination, and failed to preserve some client contracts.

Morgan Stanley “is pleased to settle this matter, which included inadvertent billing errors in certain managed accounts,” said firm spokeswoman Christine Jockle in an e-mail.

“All affected clients have been reimbursed and the firm has enhanced its policies and procedures, including discontinuing the use of certain legacy systems.”

In the Citigroup case, New York regulators said its Smith Barney unit overcharged about 47,000 customers more than $22.5 million in fees on its TRAK fund-wrap program, as well as other advisory accounts.

It’s not clear what time period the New York case covers. The state said an investor who initiated the case by filing a complaint with the attorney general’s office in 2012 had been overcharged for about four years.

A spokesperson for the attorney general’s office could not provide more details by press time Friday.

Citigroup began reimbursing customers in October 2014, and has returned $22.5 million, the state said in its release.

In an e-mail, Citigroup spokeswoman Danielle Romero-Apsilos said the firm was pleased to have the matter resolved.

Most of the overcharges were the result of Smith Barney failing to apply discounts that customers had negotiated on mutual-fund wrap programs. A wider review by the firm begun in October 2014 found more improper charges on other fee accounts, such as $4.6 million charged on accounts that had been frozen because of a death, transfer or regulatory inquiry.