Upper tier judge Lord Doherty dismissed the appeal against a first-tier tax tribunal decision, although he has referred several issues back to the original panel.
The tax authority had argued that payments made to players and other employees should be taxable but the Murray Group, which formerly owned Rangers, argued they were loans.
The first-tier tribunal (FTT) had issued a 2-1 majority verdict which favoured, in principle, the Murray Group in November 2013 and ordered that HMRC's £46.2million demands, about three-quarters of which referred to the liquidated club, be "reduced substantially".
The upper-tier appeal has largely upheld that verdict but some payments will be re-examined by the original tribunal, including termination and "guaranteed bonus" payments.
However, the Murray Group appeared to secure an additional victory relating to payments made to several people including former Ibrox chairman Sir David Murray, which it argued were not special cases.
The judgement, which has no impact on the current Rangers regime, reads: "The appeal is dismissed except in so far as it relates to the termination payments.
"I shall remit the case to the FTT (i) with a direction to allow the taxpayers' appeals against the assessments relating to the payments to the sub-trusts of Sir David Murray, his sons, Mr McClelland and Mr MacMillan; (ii) to proceed as accords in relation to the termination payments, the payments in respect of guaranteed bonuses, and any related questions of grossing up.
"Standing my findings and my disposal, the remit should be to the FTT as originally constituted."
It is unclear how many termination payments were made but the FTT's decision referred to five "guaranteed bonus" payments.
Murray expressed satisfaction with the ruling but stated there were no winners.
In a statement issued to Press Association Sport, a spokesman for Murray International Holdings said: "We are satisfied that the UTT (upper tier tribunal) has now published its widely awaited decision and note the contents thereof.
"We are pleased with the judgement which again leaves negligible tax liability and overwhelmingly supports the views collectively and consistently held by our advisers, legal counsel and MIH itself.
"We will therefore review the detailed content of the decision with our legal counsel and advisers to ascertain what action, if any, is now required by MIH.
"The decision substantially reduces HMRC's claim in the liquidation of the old Rangers Football Club.
"While we have been successful in both the FTT and UTT, there are, as we have stated previously, no victors.
"This has been an exceptionally long, difficult and expensive process involving not just the FTT and UTT but also several approaches to resolve the matter with senior HMRC officials on a commercially sensible basis for all parties which were rejected.
"MIH has, at all times, recognised that the tax tribunal proceedings stemmed from arrangements put in place during its ownership. They were introduced before legislative changes removed the tax efficiency of such arrangements from the end of 2010.
"However, it is obvious that the much publicised existence of these proceedings overshadowed Rangers Football Club for many years and tarnished the external perception of its value.
"There can be little doubt that despite favourable legal opinion, potential acquirers were therefore dissuaded from pursuing their interest during a period in which we were marketing the sale of MIH's shareholding.
"The case has also stimulated extensive press and social media comment, discussion and speculation, a significant quantity of which has been ill informed.
"During proceedings, it would have been entirely inappropriate for us to highlight fundamental misunderstandings or contribute to this public debate.
"Notwithstanding all of this, it is abundantly clear that Rangers Football Club would not have gone into administration or liquidation had the purchaser fulfilled its contractual obligations and responsibilities.
"Similar to the resolution of the UTT appeal, we hope that the relevant authorities conclude their investigations and commence proceedings at the earliest opportunity."