The ministry wanted to reclaim the money, totalling $109,852, and said Ms F had been overpaid.
MSD had originally wanted her to repay more than $120,000 of her benefit.
But, Justice Davison said MSD should not have categorised the source of the funds as income.
"The bank loans did not truly add to Ms F's resources as she was required to repay the funds she received," the judge said.
"Bank borrowings by use of a credit card have the same essential characteristics as a bank loan, in that credit card expenditure is to be repaid. Credit card spending is therefore a loan, and is not properly treated as income."
Justice Davison also said the Social Security Appeal Authority wrongly classified the money Ms F got from her mum as a gift, rather than a loan.
Ms F said she had repaid most of the $130,000 loan after the sale of her house.
"This decision will bring a collective sigh of relief to thousands of beneficiaries who have had to borrow to make ends meet," Frances Joychild QC, counsel for Ms F, said in a statement.
"It is extraordinary that the ministry ever countenanced counting a loan as income, when it was well aware that the level of benefits kept beneficiaries below the poverty line. By denying them a benefit if they borrowed money it was locking them into the multiple deprivations that income tested beneficiaries experience," she said.
Following the decision, Child Poverty Action Group (CPAG) called on the Minister of Social Development Carmel Sepuloni to immediately remove all debts, cases and prosecutions against beneficiaries where loans have been counted as income.
CPAG economics spokesperson Associate Professor Susan St John said the group was overjoyed by the result and commended Ms F.
"Her courage and passion for justice will have enormous benefits for others like her struggling in an unjust system," St John said.
Advocacy group, Auckland Action Against Poverty also welcomed Justice Davison's decision.
Ricardo Menendez March, the group's coordinator, said the current welfare system means people on the benefit are living below the poverty line and are often forced to take loans to meet essential needs.
"The Ministry of Social Development's approach to our current inequality crisis should be one of compassion and assistance, not of punitive legal prosecutions," he said.
"The High Court ruling that loans cannot be counted as income for the purpose of social security should pave the way for a wider review of High Debt recovery cases against people on the benefit. We expect, at the very least, for all debt recovery cases to be put on hold while a review is happening."
He continued: "It should have not taken this long for the MSD to be called out for clearly misinterpreting the law and punishing people. This is not the first time that the ministry ignores its duties to help people."