Nevertheless, he said her guilty plea to a single murder charge limited his ability to give her a life sentence.
Cunningham showed little reaction behind her mask in the courtroom.
At Thursday's hearing, she took the stand to ask for mercy, and claimed she loved her son but was disabled by a drug addiction.
Her addiction, she said, led her to beat Freund to death with a metal shower head and then claim he went missing before investigators discovered his body in a shallow grave in Woodstock.
Many observers, including the 5-year-old victim's family, reacted strongly.
A group calling themselves "Roar for AJ" gathered outside the courthouse and called for the maximum 60-year sentence.
"We, the family of our beloved Andrew, are disappointed and saddened by the ruling of the Judge. We know that whatever the punishment, it will not ease the loss and pain we feel. AJ was an innocent, precious little boy whose life was taken from him after he endured ... much pain and suffering," ROAR said in a statement.
"This is not justice. ... If she got 60 years it still wasn't justice," said Tracy Kotzman with ROAR.
McHenry County State's Attorney Patrick Kenneally handled the high-profile case personally.
Kenneally met with reporters off-camera and reacted to the sentence, saying "We are disappointed. We thought all the factors were in place for the maximum sentence, which we thought was appropriate."
Crystal Lake representative Tom Weber introduced a bill in honor of AJ.
"Bottom line, we have nothing to celebrate ... nothing will take away the suffering," he said.
At the end of the hearing Thursday, Cunningham addressed the court tearfully, saying in part, "I had the privilege of having AJ as a son. When I had him it was one of the happiest days of my life. I love him and I miss him and there's nothing I wouldn't do to bring him back."
On Thursday, Crystal Lake Police Officer Kimberley Shipbaugh described a visit to Cunningham's home back in December of 2018, where she observed filthy living conditions and noticed 5-year-old AJ with bruises, so she asked how he got them.
"JoAnn leaned down and in his ear she said to him, 'Lucy the dog did that to you right?' And then he said 'Yes,'" Shipbaugh said.
AJ was seen at a local emergency room where doctors suspected abuse.
"I started by asking him if he had been spanked or hit, he said 'Yes,'" said Dr. Joelle Channon. "I asked him with what and he said 'a belt.' I asked him, 'Who did it?' and he said, 'Someone not in my family' and then he offered that, 'Maybe mom didn't mean to hurt me.'"
A series of video tapes were played in court where Cunningham is heard interrogating her son about who he would run to tell about any abuse. At one point, his little voice replied the devil. The recording was made by Cunningham just days before he was killed.
On April 15, 2019, Cunningham claimed she put her five-year-old son AJ to bed the night before and the next morning, he was gone.
For days, police, family, friends and even strangers organizing vigils and search parties for AJ.
RELATED: Crystal Lake home of murdered boy demolished
Video of her initial meeting with police shows Cunningham saying a prayer before telling them she had no idea where her son was. Days later, police found his body in a shallow grave in Woodstock and charged his parents with murder.
RELATED: JoAnn Cunningham, mother of slain Crystal Lake boy AJ Freund, pleads guilty to murder
AJ's father Andrew Freund later told investigators Cunningham hit the boy and forced him into a cold shower before putting him to bed.
He said the next morning, the couple found AJ dead and Freund later buried him.
Andrew Freund is also charged with murder.
The Illinois Department of Children and Family Services initially took custody of AJ when he was born with opiates in his system. The foster mother who cared for him for the first 18 months of his life told the court she would have been there to help Cunningham if she had allowed it.
ABC7 Eyewitness News is not identifying the foster mother, but she told the court "All of us had a piece of our hearts ripped out. Going through this is the most difficult thing my family has ever gone through. We miss AJ every day and will never forget his smile."
AJ Freund: Crystal Lake home of murdered boy demolished
Sentencing date set for JoAnn Cunningham, mother of AJ Freund
JoAnn Cunningham, mother of slain Crystal Lake boy AJ Freund, pleads guilty to murder
McHenry County commissioner among 2 DCFS workers sued in AJ Freund case
Andrew 'AJ' Freund's abuse repeatedly reported to DCFS, lawsuit alleges
Crystal Lake community holds memorial walk to honor AJ Freund's birthday
Efforts underway to tear down Crystal Lake home of AJ Freund: Report
Andrew Freund, father of Crystal Lake boy AJ Freund, deemed mentally fit for trial in son's death
Wrongful death lawsuit may be filed against DCFS for handling of AJ Freund case
Prosecutors seek to terminate parental rights of couple charged in AJ Freund's death
Murdered Crystal Lake boy AJ Freund's parents in court Tuesday
Murdered boy AJ Freund's mom gives birth in custody
Andrew 'AJ' Freund's foster family releases statement: 'AJ was loved by us'
AJ Freund death: Parents of 5-year-old Crystal Lake boy appear in court Monday
Crystal Lake boy AJ Freund funeral arrangements announced; DCFS releases timeline, 2 workers reassigned
Two child deaths two years apart have DCFS back on hotseat
AJ Freund cause of death released, parents bond set at $5M each for Joann Cunningham, Andrew Freund, Sr.
How did Crystal Lake police crack the case of AJ Freund?
'He got a raw deal and God's going to fix it': Crystal Lake mourns AJ Freund after body found
Missing Crystal Lake boy AJ Freund's body found; parents Joann Cunningham, Andrew Freund Sr. charged
Missing Crystal Lake boy: 911 call reporting Andrew 'AJ' Freund, 5, missing, police history with family released
Missing Crystal Lake boy Andrew 'AJ' Freund: Father continues search, mother pleads for boy's, 5, return
Search continues for missing 5-year-old Crystal Lake boy, father vows own investigation
Crystal Lake community holds vigil for missing boy to "light the way for AJ"
Missing Crystal Lake boy Andrew 'AJ' Freund: Boy, 5, did not leave home on foot, police say
Crystal Lake boy missing: FBI joins search for 5-year-old Andrew 'AJ' FreundJoAnn Cunningham tearfully addresses court at sentencing for son's murder