Viktor Sviridov was at one time the head of the federal prison service's motor transport department.
He was convicted of extorting 10 million roubles (£121,000) from the service's former deputy director.
Just moments after the judge ordered he be taken into custody, Sviridov shot himself in the head.
A court spokeswoman quoted on Russian news site RBC says he is thought to have brought the gun into the court himself.
Police are at the scene. Authorities have announced an investigation into court security following the shooting, RIA news agency reports.
Sviridov was reportedly ill with stage four terminal cancer. He was under house arrest before the trial, which took place at Moscow's Chertanovsky court.