The billionaire businessman behind Beanie Babies learned Tuesday that he won't go to prison for hiding at least $25 million from U.S. tax authorities, and the judge who gave him two years' probation instead went to great lengths to praise his charitable giving.

H. Ty Warner, one of the highest profile figures snared in a federal investigation of Americans using Swiss bank accounts to avoid U.S. taxes, issued a brief apology before he was sentenced in Chicago federal court. The toymaker, who pleaded guilty to a single count of tax evasion, said he felt "shame and embarrassment" for what he had done.

Warner, 69, could have been sentenced to up to five years in prison, and a prosecutor Michelle Petersen asked U.S. District Judge Charles Kocoras to give Warner at least a year behind bars.

Peterson detailed how Warner meticulously hid his income — more than $100 million at one point — by filing false tax returns for at least 11 years, and pointed out that another area businessman caught in the same dragnet, Peter Troost, got a year in prison from another judge in that courthouse for hiding far less — $3 million.

"(Without prison time), tax evasion becomes little more than a bad investment," Petersen told the judge. "The perception cannot be that a wealthy felon can just write a check and not face further punishment."

Kocoras, though, opted against prison time, and he devoted most of the 20 minutes he spent explaining his sentence praising Warner's charitable work.

"Society will be better served by allowing him to continue his good works," he said, adding that he believed the Oak Brook toymaker had already paid a price in "public humiliation" and "private torment."

Warner, who grew up poor and had an unhappy childhood, according to his attorneys, created Beanie Babies in the mid-1990s. The small, plush toys resembling bears and other animals triggered a craze that generated hundreds of millions of dollars for his Westmont-based TY Inc. Forbes recently put his net worth at $2.6 billion.

Warner maintained a secret offshore account starting in 1996 with the Switzerland-based financial services company UBS — shifting millions to another foreign bank when U.S. authorities began closely scrutinizing UBS. He even instructed the bank, under its rules, to destroy some records, Petersen said.

But Kocoras said that, in Warner's case, his "endless acts of kindness" deserved to "trump" his criminal behavior.

The judge recalled how Warner, after getting lost driving in Santa Barbara, Calif., pulled over to a parking lot fundraiser and told a woman with a kidney ailment that he would pay her $20,000 medical bill. He also mentioned Warner's $20 million charitable donation from proceeds from a toy he helped design commemorating Princess Diana after her death.

As part of his sentence, Kocoras also ordered Warner to do 500 hours of community service at local Chicago high schools. When he pleaded guilty, Warner agreed to pay $27 million in back taxes and interest, and a civil penalty of more than $53 million — one of the largest such penalties ever paid.

After the hearing, the U.S. attorney for Chicago, Zachary Fardon, said the sentence "is less than we asked for but is not nothing." He cited, among other things, the fines, community service and "the abject humiliation" of facing federal prosecution.

"I think that's the message folks should receive — that (tax evasion) is a crime that does not pay," he said.

Just before Tuesday's hearing adjourned, Kocoras said that as a formality, he needed to advise Warner that he had the right to appeal his sentence. The judge then laughed, adding, "if you think you can get a better deal in the court of appeals."