The court found Philipp Körber, 33, guilty of nine charges of manslaughter as well as bodily harm and illegal weapons dealing.
At seven years, the sentence comes close to the term called for by prosecutors, who said Körber shared German-Iranian killer David Ali Sonboly's extreme far-right views, knew of his plans and bore a share of responsibility for his crimes.
Victims' relatives had called for an even harsher sentence for aiding and abetting murder.
“The accused is guilty of deliberate illegal arms trading, in concurrence with manslaughter and bodily harm,” judge Frank Zimmer said.
“He is undoubtedly a right-wing radical… a convinced adherent of the Führer of the Third Reich” Adolf Hitler and a “can certainly be described as a racist,” he added.
Police arrested Körber in August 2016 after tracking him down online and luring him into a fake weapons deal.
Körber and Sonboly met via the so-called Darknet – hidden internet sites often used for criminal dealings that can only be accessed using encryption technology.
He sold the 18-year-old a pistol and ammunition, which the younger man used in July 2016 to kill nine people and wound five before turning the gun on himself.
Almost all of Sonboly's victims had a migrant background, and he struck on the fifth anniversary of a massacre by Norwegian far-right extremist Anders Behring Breivik.
Both he and Körber used the Nazi greeting “Heil Hitler”, and investigators found the dictator's manifesto Mein Kampf on Körber's computer.
But police said Sonboly wanted revenge for years of bullying rather than political goals, targeting people similar to his tormentors.
Körber's defence acknowledged the arms dealer had broken weapons laws, but insisted he did not know what the buyer planned.
It also underlined the accused's full confession.
“I never wanted this. I am unbelievably sorry about what happened,” Körber told the court early Friday.
Sonboly's killing spree came four days after a 17-year-old Afghan refugee seriously injured five in an axe attack on a train.
In the same week a suicide bomber wounded a dozen people.
The spate of violence spread disquiet in Germany, where some feared an increased risk of terror attacks after the arrival of more than a million migrants and refugees in 2015-16, many of them from war-torn parts of the Middle East.