She was sentenced in her absence after apparently taking an overdose of painkillers in court shortly before the hearing started.
Judge Karen Walden-Smith said: “This was a deliberate and persistent making of false statements for the purpose of falsely recovering significant monies from a publicly-funded body.”
The judge said only immediate custody was possible, given the “great seriousness” of the contempt committed by Elder.
She added: “This was an attempt to effectively defraud the NHS of a sum of more than £2 million – public funds which are desperately needed for frontline services.”
The judge told the court Elder suffered a genuine injury as a result of the surgery, which it later transpired was not necessary because she had been misdiagnosed.
The NHS trust admitted liability but disputed the amount she claimed, and a judge at a county court in 2017 ruled she was entitled to just £120,000.
Judge Iain Hughes QC rejected her claims that she had become isolated and dependent on others for routine tasks including housework and shopping following the surgery.
He found she had not suffered the significant disability she alleged after surveillance footage showed her walking unaided, visiting the zoo with her grandson and shopping.
The NHS Trust brought committal proceedings against her at the High Court over the lies she had told during the county court case.
Judge Walden-Smith said Elder’s claims involved “extensive and widespread exaggeration and lies” – including her assertion that she could not go to her daughter’s hen party when in fact she was there and “fully participating”.
Our video below reveals what the top 20 painful health conditions that can stop you performing daily tasks
NHS reveals the 20 painful health conditions that can stop you performing daily tasks
The judge said her mitigation included the fact she had suffered actual harm as a result of the unnecessary surgery and her previous good character.
She had also donated a kidney to her ex-partner to prevent her daughter from having to do so, which has had a further impact on her health.
The sentencing was delayed after Elder appeared to take a number of pills shortly before the judge came into court.
She was taken to hospital and the judge went ahead with the hearing in her absence.
Elder is likely to be released from prison after serving half her sentence.