Illinois State Police also said 19-year-old Matthew Milby's mother bought the weapon in 2012 and that investigators were working to determine how he obtained it.
Classes were canceled Thursday at Dixon High School, a day after authorities say Milby showed up in the morning as seniors met for a graduation rehearsal and fired several shots inside the building.
Milby, who was wounded in an exchange of gunfire with the officer, was transferred Thursday from a hospital to the Lee County Jail, the Dixon Police Department said. He was in custody under a $2 million bond, with an arraignment hearing possible on Friday, according to state police. No one else was injured in the shooting.
Julie Milby told reporters on Wednesday her son was recently beaten up, other students stole from him and he was kicked off the football team for smoking marijuana.
"What this all led to was more ostracization," she said. "I just know that the kid's been real sad for a long time."
Julie Milby said Wednesday she didn't know how her son got the gun that he took to school. The Associated Press couldn't immediately contact her for comment on the state police announcement regarding the gun because a phone number in her name wasn't found.
State and city leaders praised Officer Mark Dallas, a 15-year veteran of the Dixon Police Department, as a hero for confronting Milby.
Some students returned to the 800-student school about 80 miles (130 kilometers) west of Chicago on Thursday to retrieve belongings left behind when police evacuated the building. A new graduation rehearsal was planned for Thursday afternoon and the ceremony was still set for Sunday.
Sophomore Tanner Portner said he was surprised to learn Milby had been identified as the shooter.
"He seemed all right. I never would've expected him to do this," Portner said.
Dixon senior Brianna Johnson said she saw Milby enter the gym area with a gun, then heard several shots before a teacher slammed the door and students sprinted away.
"He seemed like a really nice kid, but then everything changed and he was angry and high all the time," Johnson said.
Matthew Milby is charged with aggravated discharge of a firearm, aggravated discharge at a school employee and aggravated discharge at a school building.
Sauk Valley Media reports Milby was convicted in April for a 2017 arrest for marijuana possession of less than 10 grams of marijuana and fined $120.
Milby said her son was supposed to take part in Sunday's graduation ceremony and that she's grateful more people weren't hurt.
"Thank God they didn't kill him, so that's a blessing," she said. "Thank God he didn't kill anybody else ... There is no justification for what he's done, and he will take full responsibility for that."
Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.