Police said that the kidnappers were part of the Frente Jaime Martínez, an off-shoot of the Farc rebel group that continued fighting after Farc agreed a 2016 peace deal.
The boy's mother described his release as "a miracle", adding that the weeks he had been in captivity had been "horrible, a nightmare".
Many dissident rebel groups such as the Frente Jaime Martínez finance themselves through extortion and kidnappings for ransom, as well as drug trafficking.
The commander of the regional police force, Brigadier General Carlos Oviedo, said the boy's stepfather had been the real target of the kidnappers, but that they had seized the boy when they found that the stepfather was not at home.
The stepfather, a local merchant, told local media that he was not involved in any illicit business and said he did not know why he had been targeted.
It is not clear if a ransom was paid for the boy's release.
His stepfather said the boy had told the family that he had been shackled for the first four days of his captivity but was in good health.
His mother said that her son appeared anxious and that he had bitten his fingernails down. He was taken to the local hospital for examination.
The mayor of Jamundí, the town where the family lives, thanked the local community "for not giving up" and for holding rallies demanding the boy's release.
Colombia's vice-president, Francia Márquez, had also demanded that the boy be freed. "Ife is sacred and the freedom of any human being is non-negotiable, less so when it's that of a child," she wrote in a statement.