The court ruled the men had been detained in prison longer than the maximum period allowed by law, which is two years, Ahram Online reported.
The two men, though, will remain in custody because they face other corruption charges, the news service said.
The court also ruled the retrial of Mubarak -- on charges he failed to protect protesters and was complicit in the deaths of unarmed protesters during the 18-day uprising that led to his ouster in 2011 -- will resume July 6.
The 84-year-old former leader, who is in failing health and being held in Cairo's Tora Prison Hospital, had previously been convicted and given a life sentence on the charges but was granted a retrial because of procedural problems.
The retrial has been put off three times -- most recently postponed for 30 days in May so a presiding judge could have time to read thousands of pages of documents.
The reason for Monday's extension was not reported.
Mubarak also faces charges of illicit gains and exporting natural gas to Israel at below-market prices.
Celebrity Breakups and divorces of 2014 [PHOTOS]