WASHINGTON – A subsidiary of investment firm Legg Mason Inc. has agreed to pay about $21 million to settle U.S. government claims that it concealed losses to investors and engaged in prohibited transactions that favoured some clients over others.

The settlement with Western Asset Management was announced Monday by the Securities and Exchange Commission and the Labor Department. The agencies said Western Asset didn’t disclose and quickly correct a computer coding error that caused losses for holders of about 100 employee-benefit retirement plans. They said most clients were notified nearly two years later, in 2010.

The government said the Pasadena, Calif.-based Legg Mason unit also improperly moved securities among client accounts.

Western Asset neither admitted nor denied wrongdoing. Legg Mason said in a statement that it chose to settle to avoid the uncertainty, cost and distraction of fighting in court.

It agreed to return about $17.4 million to employee-benefit plans and to pay $3.6 million in penalties. The majority of the payment is covered by insurance, it said.

Legg Mason said its subsidiary has “has redoubled its efforts over the past five years to address regulatory compliance and related matters including the strengthening of controls in the areas covered by the settlements.”