The high court ruled 9-0 that the government does not have a "fiduciary obligation" to return funds to the public sector unions.
The unanimous ruling ends a long legal battle dating back to the 1990s in which unions representing public servants, the RCMP and the military wanted the surplus money returned.
The unions and professional associations were attempting to overturn an Ontario Court of Appeal ruling that said they weren't entitled to the money.
The unions argued that the government improperly took their money, from the mandatory, defined benefit plans.
The plans are among some of the most handsome pensions in the country.
Paul Cavalluzzo, a lawyer for Professional Institute of Public Service of Canada, one of the unions appealing the lower court ruling, told CBC News the union was disappointed.
Cavalluzzo said the federal government built the surplus on the backs of the people who contributed to the pension, so it is unfair that the funds can be used for purposes other than pension benefits.