The execution machine at the center of "In the Penal Colony" seems ingeniously designed to inflict one of the most elaborate and horrific forms of suffering imaginable on the prisoners condemned to go into it: it writes their sentences on their bodies in their own blood over the course of twelve hours. In the process of this extreme suffering, the condemned man is supposed to experience a special kind of enlightenment, to learn something through the pain of his body that he couldn't learn otherwise. The attraction that this "transfiguration" through suffering has for the officer, who serves as the colony's judge, eventually leads him to go into the machine himself.
The prisoner reaches enlightenment through suffering under the Harrow by feeling his guilt, and feeling truly repentant, for the first time.
The officer does believe suffering is an end in itself.