His co-defendant, Michael Clifton, is serving 98 years in prison for the same crimes.
However the district attorney who prosecuted Lima-Marin realised the mistake after finding he was no longer in jail and he was ordered back to prison in 2014, The Denver Post reported.
Chief Arapahoe County District Judge Carlos Samour Jr this week said he should be free.
Judge Samour wrote that it would be "draconian" to keep Lima-Marin in prison and that he was rehabilitated.
"Although most of Lima-Marin's sentence remains unserved, he has sufficiently paid his debt to society," the judge wrote.
Judge Samour also pointed out that Lima-Marin, who did not know in 2008 that he was released by accident, had already completed parole and started a family before authorities returned him to prison.
He had married his former girlfriend, Jasmine, upon release and helped raise her son and the pair had a second child together before Lima-Marin was sent back to jail.
The decision to send him back for another 90 years devastated his family.
"Without the ability to turn back the clock, how does the court dispense justice under such circumstances?" the judge asked.
"Requiring Lima-Marin to serve the rest of his prison sentence all these years later would be draconian, would deprive him of substantive due process, and would perpetrate a manifest injustice.
"Because the Court finds that Lima-Marin is being unlawfully detained, he is ordered released. No other remedy will result in justice in this case."
The judge also slammed "the government's conscience-shocking deliberate indifference" when it accidentally released a man and didn't notice the error for six years.
The judge also noted that sending him back to jail would "would perpetuate a manifest injustice" adding Lima-Marin had become an "asset to society" and an "outstanding citizen".
His lawyer Kimberly Diego said her client was a model citizen, CNN reported.
"His case was unique in that sense," she said.
"Not all people who are rehabilitated behave that way."
Lima-Marin is currently being held at the Fremont Correctional Facility in Canon City, Colorado.
However there was no immediate word from the state Department of Corrections on when Lima-Marin would be released from a prison in southern Colorado, according to The Denver Post.
The Colorado Attorney General's office is currently reviewing the decision.
The mix up
A simple clerical bungle is to blame for the error which saw Lima-Marin released early in the first place.
According to The Denver Post, the paperwork said his sentences were to be served concurrently, instead of consecutively.
Clifton's mistake was discovered and corrected during an appeal. But Lima-Marin's lawyer advised him not to appeal - and the mistake remained and he was released on parole in 2008.
When Lima-Marin was taken back to prison, a new fight began to secure his freedom and his plight was the subject of a change.org petition which asked for his release.
In December 2015, the Colorado Supreme Court agreed to hear oral arguments for his freedom but the case was dismissed the following month.
The Colorado Legislature approved a nonbinding resolution earlier this month urging Governor John Hickenlooper to grant Lima-Marin clemency.
'Not the same person'
Speaking to documentary makers last year from prison, the 37-year-old said he knew what he did was wrong, but that he was a changed man and not the dumb kid he was back then.
"I believe that right from the beginning I was given a punishment that didn't fit the crime," he said.
"It was just a robbery but they added three counts of kidnapping and they added burglary and they added these different things so that they can give you as much time as they possibly can.
"No one was injured, no one was hurt, the weapons weren't even loaded. Nothing happened that didn't happen in any other robbery that someone gets 5-10 years for.
"I'm not saying that I was right in any way. I take full responsibility for the dumb, ridiculous, stupid mistake that I made when I was 18 years old."
His wife Jasmine told The Guardian the decision to send her husband back to prison had torn her family apart and she just wanted her soulmate back.