On TV he played a ruthless mobster pursued by the Feds. But in real life actor James Gandolfini was a generous soul. Indeed he may even have endeared himself to the IRS as his will is revealed as an example of how not to settle your affairs, according to the experts.
Gandolfini's will was written in a way that astute estate planners say skipped many options for minimizing his tax bill.
(Read more: Actor James Gandolfini, star of 'The Sopranos,' dies in Italy)
One example: Gandolfini left just under 20 percent of his assets to his wife, with the rest going to his sisters and infant daughter. (He made "other provisions" for his son Michael from a previous marriage, the will says.)
Federal tax laws allow for unlimited tax free transfers to spouses, but taxes are applied to most other bequests in estates over $5.25 million. Gandolfini only took limited advantage of that provision, so close to 80 percent of the assets covered by the will could now be subject to state and federal taxes that together can reach a rate of 55 percent.
Certainly, Gandolfini may have had priorities other than taxes. He may, for example, have wanted to make sure Michael had his own inheritance so he would not be dependent on his stepmother.
"I very often have clients that make very well informed decisions that might not be the most tax efficient," said Mickey Davis, a partner at Davis Willms.
Also, while the size of Gandolfini's estate is unknown – published reports estimate $70 million, but Gandolfini's estate attorney told The New York Times that figure is not accurate - the estate was almost certainly substantial, and Gandolfini may well have had assets like retirement accounts and life insurance policies that are not covered by the will and its tax rules.
(Read more: Retirement planning can help high earners avoid big tax hit)
But legal and tax experts say that if minimizing taxes was a priority, Gandolfini's will could have been better written.
"You don't know what was explained to him and you don't know what his choices were," said Christina Mason, a partner at Kelley Drye & Warren. "Probably three-quarters of people approach it in the most tax efficient way, but the others don't." From what's been revealed about his estate, Gandolfini seems to have been in the latter camp, she added. "On the face of it, it looks as though it's very tax inefficient."
So how can you be smarter than James Gandolfini when it comes to estate planning?
For starters, consider taking greater advantage of the marital deduction. If you leave all your assets to your spouse, you don't owe estate taxes. (Your spouse's estate will, though, if it is large enough.)
Trusts are another tool for managing large estates. Gandolfini "could have made some significant gifts to his siblings and to his daughter and put them in trust and told the trustee 'don't distribute these until I'm gone, but grow these during my lifetime,'" Davis said. "Once he's put them in trust, the assets would avoid the estate taxes."
(Read more: Yours, hers, and the kids': estate planning after remarrying)
Still, trust assets have to have time to grow, and Gandolfini died at age 51. To make sure trusts have value at any time, Davis says Gandolfini could have created trusts and had the trustees take out life insurance on him. That way, the insurance would have provided for his heirs even if the trusts themselves were still small.
Another issue with Gandolfini's will is the plan to leave assets for his infant daughter that become hers free and clear when she turns 21.
"Our recommendation is typically to put it in trust until 25, because that gets the kids through college," Mason said. "Even if they're completely spendthrift, at least they've gotten a college education paid for."
Davis says older may be even better. His younger clients, he says, often opt to have children come into half of their assets at age 25 and half at 30. "Often later they come back to us and say 35 and 40."
Then there is the matter of real estate. Gandolfini owned a home in Italy, and in his will he give each child a 50 percent stake. But there is no mention of how to pay for upkeep——and there seems to be no reference to Italian laws that would come into play. For example, in some European countries there are laws governing who inherits real estate.
"If you've got a client with a house in Italy or a flat in London, they need to be talking to local counsel," Davis said.
In the end, no one in Gandolfini's family is likely to come up short. But paying lower taxes would have left them even better off.
End of story.
—By CNBC's Kelley Holland. Follow her on Twitter @KKelleyHolland.