The NUM had asked Mr Justice Underhill at London's high court to declare that it has no such continuing obligation to 74-year-old Scargill, who was its president for 20 years until July 2002.
Scargill has occupied the Barbican apartment, rented from the Corporation of London, since June 1982.
The union also successfully disputed Scargill's fuel allowance at his Barnsley home and payment for the preparation of his annual tax return, but not the cost of the security system at his Yorkshire home.
Explaining his decision, the judge said Scargill's predecessors had enjoyed the "very generous benefit" of having houses in or near London bought for them by the union, adding that they were also allowed to occupy the properties after retiring at a very low rent, or to buy them at a "very reduced price".
But Scargill, he noted, had not taken up the benefit when it appeared in his first contract in 1982 – although the union's national executive committee had agreed to pay the rent and other expenses on his Barbican flat, which was near the NUM's London headquarters.
He rejected Scargill's claims that the union's payment of the rent on the flat was intended to replace the benefit his predecessors had enjoyed and was therefore a lifetime benefit.
The judge said the claim was not reflected in the original minutes of the NEC, was not backed up by the contract Scargill signed, and pointed out that the union had continued to subsidise the mortgage on his Yorkshire home.
He added: "It was [also] known at the time of his election that the union might well shortly be moving its headquarters outside London (as it in fact did). I have found that it is more likely that the understanding at that time was that the payment of the rent of the Barbican flat was in the nature of a facility to enable Mr Scargill to do his job properly and that he retained the right in due course to have a house bought for him by the union."
The judge went on to note that the union had not paid the rent on the flat for a six-year period from 1985, and that Scargill had decided in 1991 that he did not want to take up the housing benefit to which he had been entitled since 1982, preferring the union to resume paying the rent on the flat.
What Scargill should then have done, he said, was go back to the union and get authorisation for the arrangement. Instead, without obtaining the NUM's blessing, he had sought legal advice, which supported his right to have the union pay for the flat.
"None of this was disclosed to the NEC," said the judge. "The legal advice was based on information provided by him which did not give the full picture; and anyway it could not make up for the absence of NEC authorisation."
As a result, he concluded, the contract appearing to give Scargill the right to have the NUM carry on paying the rent after he retired was not effective as the NEC had not approved it in the first place.
After the ruling, the NUM general secretary, Chris Kitchen, said it was "regrettable" that it had had to bring the case, while Scargill said the judgment was "perverse" and flew in the face of all the evidence.
He said: "There can be no doubt that 30 years ago I was given an entitlement to a property by the union and that entitlement continued during my retirement, as it had done for all my predecessors including Lord Gormley and, after he died, his widow Lady Gormley."
On the question of an appeal, he said: "I shall talk to my lawyers about what the best course of action will be, but I think any independent observer will regard this as yet another judgment with the anti-Scargill feeling about it."
guardian.co.uk © Guardian News and Media Limited 2010