Thirteen relatives of victims spoke during the hearing including Simone Crawley, who called Gendron, 19, a "cowardly racist."
The sentence, which was expected because the state does not employ the death penalty, was given by Erie County Court Judge Susan Eagan.
Erie County District Attorney John Flynn and Buffalo Mayor Byron Brown called Gendron's apology too little and too late.
"I anticipate what he said today was to save his life in federal court," Flynn said after the hearing.
His lawyers have sought a plea deal relating to these in an effort to avoid a possible death sentence.