The penalties were incurred as a result of failed repossession actions by lenders against struggling mortgage holders.
Legal experts and consumer rights campaigners are now battling on behalf of an estimated 7500 affected householders who have been landed with what they see as unjustified legal fees, typically ranging from £3000 to £5000.
Lenders have been relying on a standard provision in the Conveyancing and Feudal Reform (Scotland) Act 1970 entitling them to charge a mortgage customer for all expenses "reasonably" incurred in the calling up and enforcement of a mortgage.
But solicitors and consumer rights campaigners argue the legal costs should never be imposed on failed cases, and are embarking on a campaign to reclaim the money for homeowners through the Financial Ombudsman Service.
The Financial Services Authority's (FSA) conduct of business rules prevent lenders from imposing unfair and excessive charges.
A test case being taken to the Ombudsman involves a Glasgow homeowner who was billed for £10,000 in legal expenses and charges for an action that was dismissed.
Mike Dailly, principal solicitor of the Govan Law Centre, who is spearheading a campaign to recover the funds, is one of four FSA-appointed representatives of the Financial Services Consumer Panel, the independent financial services consumer watchdog. He was also the solicitor to the UK unfair bank charges campaign between 2005 and 2008.
He said: "It is a simple case of fairness and lenders must be worried about this."
Mr Dailly, who is also a member of the Secretary of State for Scotland's Poverty Advisory Group, added: "Incompetent or defective proceedings cannot be the fault of consumers, it is the responsibility of lenders and their Scottish solicitors. It is unfair, immoral, and unethical for Scottish solicitors and UK lenders to profit twice by double-charging Scottish consumers who are in financial difficulties."
The Council of Mortgage Lenders said that if costs were not added to mortgage accounts "then all customers would effectively end up paying for them, which many would regard as unfair and inappropriate".
The failed cases centre on two significant legal rulings in the UK Supreme Court and the sheriff court that resulted in thousands of repossession cases being aborted.
The first, in November 2010, saw five Supreme Court judges unanimously ruling RBS was wrong when it tried to repossess the homes of two brothers who had run up business debts, because it did not serve a calling-up notice – a legal warning that the debt had to be repaid. It effectively rendered thousands of similar cases before Scottish courts invalid, as only one in five repossessions were carried out with the notices.
The second, in March last year, saw Glasgow Sheriff Court deciding Northern Rock made legal moves to repossess too swiftly, effectively not providing a final chance to avoid court action over mortgage arrears. Legal experts said at the time that the ruling potentially rendered thousands of similar cases invalid.
According to Scottish Government data, there were 6752 repossession cases in 2011/12 – up almost 30% on the previous year.
For some facing repossession, the judgment would merely buy them extra months before facing renewed proceedings. But there is concern they are then expected to pick up their lenders' costs for the failed case and any fresh legal action.