The suspect, Philip K., told the court at the start of his trial in the southern German city that he "would have never sold him the weapon" if he had known that the gunman was planning "such a horrible act".
In a statement read out by his lawyer, he also expressed his "sincere condolences" to the families of the victims.
The 18-year-old attacker, David Ali Sonboly, killed himself after his murderous rampage at Munich's Olympia mall in July 2016, using the gun he had bought through the darknet.
Prosecutors argue that the crime would not have been possible had Philip K. not provided the Glock 17 and hundreds of rounds of ammunition, at a price of around €4,500.
He was arrested in August 2016 and charged with negligent homicide, illegal arms trafficking and other weapons violations.
As his trial began on Monday, the suspect admitted to the weapons charges and explained that he used the darknet, the hidden part of the internet, to make contact with buyers before meeting them in person to make the transaction.
His trial is set to run until September 19th. If convicted, he faces several years in jail.
Police believe Sonboly, who suffered from psychological problems and was bullied at school, had planned his mass shooting for over a year but chose his victims at random.