Rights groups called for an independent probe into the detention conditions and death of the Islamist, who was ousted in 2013 after a year of divisive rule.
State TV said the 67-year-old’s death was due to a cardiac arrest.
“He was buried in Medinat Nasr, in eastern Cairo, with his family present,” said Abdel Moneim Abdel Maksoud, one of his lawyer.
Morsi, also the country’s first civilian president, had appeared “animated” during a hearing in a retrial over charges of collaborating with foreign powers and militant groups, judicial and security sources said.
“The court granted him his request to speak for five minutes… He fell to the ground in the cage… and was transported immediately to the hospital. A medical report found… no pulse or breathing,” said the attorney general’s office.
“He arrived at the hospital dead at 4:50 pm exactly and there were no new, visible injuries found on the body.”
Another of Morsi’s legal defence team described the moment he received news of his death.
“We heard the banging on the glass cage from the rest of the other inmates and them screaming loudly that Morsi had died,” the lawyer, Osama El Helw, told AFP.
Since Morsi’s overthrow on July 3, 2013, his former defence minister, now President Abdel Fattah al-Sisi, has waged an ongoing crackdown that has seen thousands of Muslim Brotherhood supporters jailed and hundreds facing death sentences.
A judicial source said Morsi had fainted during a break in the trial hearing.
The court officials “had just finished the session for the espionage case and they informed the judge that he had fainted and needed to be transported to a hospital where he later died,” he told AFP.
Morsi last saw his family in September 2018. A month later, one of his sons, Abdallah, was arrested.
Abdel Maksoud was the last member of his defence team to see the former Islamist president, in November 2017.
The Brotherhood’s political wing — the Freedom and Justice Party — accused Egyptian authorities of “deliberately killing him slowly”.
They “put him in solitary confinement… they withheld medication and gave him disgusting food… they did not grant him the most basic human rights,” it said in a statement.
Rights group Amnesty International called on Egyptian authorities to open “an impartial, thorough and transparent investigation probe” into Morsi’s death and his detention conditions.
Human Rights Watch echoed that demand, saying Morsi had suffered years of “insufficient access to medical care”.
“The United Nations Human Rights Council… should establish an investigation into ongoing gross violations of human rights in Egypt, including widespread ill-treatment in prisons and Morsi’s death,” it said.
Turkish President Recep Tayyip Erdogan, a strong ally of Morsi and the Muslim Brotherhood, paid tribute to the “martyr”.
The Gaza-based Palestinian movement Hamas, originally an offshoot of the Brotherhood, also hailed Morsi’s influence.
Iran’s Foreign Affairs Ministry spokesman Abbas Mousavi called his death “sad and unfortunate” and said that “while respecting the views of the great nation of Egypt, offers its condolences.”
Internationally he received some support, but in his homeland, Morsi has a chequered legacy.
He spent just one turbulent year in office after the 2011 uprising, before being toppled by the military after millions took to the streets demanding his resignation.
The Islamist leader has been in prison since his ouster, on trial in several cases including for spying for Iran, Qatar and militant groups such as Hamas.
Morsi was also accused of plotting terrorist acts.
He was sentenced to death in May 2015 for his role in jailbreaks during the uprising that ousted his predecessor, long time autocrat Hosni Mubarak.
Following the news of his death, Egyptian television channels went into feverish overdrive, labelling the Brotherhood a “terrorist group” and playing a looping tagline: “The Brothers are liars”.
A group of British parliamentarians in March 2018 warned that his detention conditions had not met international standards and could lead to his “premature death”.
Other Brotherhood leaders have also died in custody.
The years following Morsi’s overthrow have seen a surge in bombings and shootings targeting security forces, particularly in the restive northern Sinai Peninsula, now a stronghold of the Islamic State group.
Morsi’s turbulent rule was marked by deep divisions in Egyptian society, a crippling economic crisis and often-deadly opposition protests.
His death comes days before Egypt hosts the Africa Cup of Nations football tournament, starting Friday.
Authorities have been on high alert, announcing on Facebook Wednesday that thousands of forces would be deployed to secure venues.