A major freight railroad won a significant victory in its long-running legal dispute with Alabama over taxes on diesel, with a U.S. Supreme Court decision issued this week.

The high court sided with CSX Transportation on how lower courts should decide whether Alabama’s sales tax on diesel unfairly discriminates against railroads, in violation of federal law.

The dispute centers on a 1976 federal law, called the Railroad Revitalization and Regulatory Reform Act, which prohibits states from imposing taxes that “discriminate against a rail carrier” regulated by the federal government.

There’s a 4 percent sales tax on everything sold in Alabama and CSX says that tax, as it applies to diesel fuel, is unfair because it doesn’t apply to other transportation operators. The company's competitors, such as trucking companies and barge operators, don’t have to pay sales tax fuel they use. Alabama exempts trucking companies' fuel purchases from the sales tax, because they pay a 19 cents-per-gallon fuel tax on diesel instead. Alabama does not tax fuel bought by barge operators at all, its lawyers say, because of federal law.

Alabama, though, encouraged the court not to look at only how transportation companies are taxed. The state argued that it was treating the railroad like other commercial and industrial businesses.

A seven-justice majority of the high court said Alabama’s interpretation was too broad.

“Nothing in the ordinary meaning of the word ‘discrimination’ suggests that it occurs only when the victim is singled out relative to the population at large,” Justice Antonin Scalia wrote.

“If, for example, a state offers free college education to all returning combat veterans, but arbitrarily excepts those who served in the Marines, we would say that Marines have experienced discrimination. That would remain the case even though the Marines are treated the same way as members of the general public, who have to pay for their education,” he added.

But the court decided that Alabama should have the chance to prove that its tax scheme does not unfairly single out railroads.

It wouldn’t make sense, Scalia wrote, “to say that a tax discriminates against a rail carrier if a rival who is exempt from that tax must pay another comparable tax from which the rail carrier is exempt. If that were true, both competitors could claim to be disfavored -- discriminated against -- relative to each other.”

The justices sent the case back to a federal appeals court in Atlanta for further deliberations.

Two justices dissented from the ruling. Alabama’s "scheme does not single out rail carriers. ...The tax is not directed at rail carriers, their property, their activity, or goods uniquely consumed by them. It is instead a generally applicable sales tax,” wrote Justice Clarence Thomas, joined by Justice Ruth Bader Ginsburg.

This is the second time the high court has allowed the dispute to go forward over Alabama’s objections. The court weighed in on the case in 2009 and returned the matter to lower courts.

Only six of the 23 jurisdictions in which CSX operates tax railroad diesel fuel. Some of those, including Illinois and New York, impose the same taxes on road and off-road diesel.