Gamal, Mubarak's one-time heir apparent, and his brother Alaa, a wealthy businessman, had appealed to the court arguing that their sentences had expired due to the time they had already spent in detention, while awaiting the trial.
The court ordered their release after taking into account the time they served since their arrest in 2011.
Mubarak and his sons were charged of acquiring almost 126 million Egyptian pound from the Presidential Palace budget and using them for construction and development of family-owned assets.
Collectively, they were fined 125 million pound and were required to repay 21 million pound.
Also Read
In May last year, Mubarak and his sons were sentenced to three years in a maximum security prison for the embezzlement.
The two were first detained in April 2011 - two months after their father was ousted during the popular uprising against him.
Gamal and Alaa were released in January after their convictions in the presidential palaces theft case were temporarily overturned. But were again taken into custody after a court found them guilty during a May re-trial.
The judge in the case said Mubarak should never be tried for these charges.
Mubarak, 87, is held in a military hospital in the southern Cairo suburb of Maadi, and it is not clear when he will be released.