PORTLAND – A Massachusetts man who got a $26,000 tax bill for bringing his plane to Maine for a few weeks on visits will get his money back, because of a court ruling that opens the door for other out-of-state plane owners to seek tax refunds for bringing their planes to Maine on business or personal trips.

In a 7-2 ruling, the Maine Supreme Judicial Court said that Steve Kahn of Bedford, Mass., should never have been taxed by Maine Revenue Services for the time he kept his plane in Maine.

Tax officials said state law allowed them to collect a 5 percent “use tax” from out-of-state residents if they hadn’t paid sales taxes on planes they had bought elsewhere and then brought them to Maine during the first year they owned them.

The court ruled Tuesday that Kahn’s plane is exempt because it was in Maine for only 6 or 7 percent of the time in his first year of ownership, which wasn’t enough to justify the tax.

In a separate but related ruling, the court said a businessman from Florida was still was on the hook for a $177,000 tax bill because his plane was in Maine for 156 days during the first year after its purchase, which the court said was enough to justify the tax.

Kahn was as shocked to win his case as he was when he got his $26,000 tax bill in 2007. He was taxed for keeping his four-seat plane in Maine for about 21 days in 2002 and 2003 while flying to his vacation home and flying in the national Angel Flight program, to pick up patients in rural Maine and bring them to Boston-area hospitals free of charge.

“I was so jaded by the system, I didn’t think I had a chance,” Kahn said. “It’s a huge moral victory, plus I get my money back.”

Maine’s use tax is applied to many goods and services that are bought out of state and aren’t subject to sales tax. State law allows tax officials to collect use taxes from airplane owners who don’t pay sales taxes on their purchases elsewhere, if they bring their planes to Maine for more than 20 days in the first year of ownership.

Before 2007, the law did not stipulate how many days the plane had to be in Maine for it to be subject to the use tax.

The law was in the spotlight several years ago, when several out-of-state residents complained about steep use-tax bills — $16,000 to $177,000 — they received from Maine Revenue Services for flying their newly purchased planes to Maine.

Jonathan Block, a Portland lawyer who represented Kahn and the Florida plane owner, said that by ruling in Kahn’s favor but against the owner of the other plane, the court is drawing a line but not saying where the line is.

“They just said this one’s on one side of the line and that’s on the other, but we’re not telling you where the line is,” said Block.

Jerome Gerard, acting director of Maine Revenue Services, said the two rulings will help define how long a plane has to be in Maine to be assessed a use tax — to a point.

“There’s no bright line cast in determining how many days a plane has to be used in the state,” Gerard said.

Block represents several other out-of-state plane owners who received hefty tax bills because they brought their new planes to Maine on visits. With Maine’s highest court deciding two of the cases, Block will review the other cases to decide who might be entitled to tax refunds.

The Legislature is looking at Maine’s tax laws and how they apply to aircraft.

The Taxation Committee plans a hearing today on a bill that would exempt aircraft sales from sales taxes, and a bill that would remove the use tax on out-of-state residents who bring planes to Maine during the 12 months after purchase.