I have always thought Nietzsche was being deliberately obscure and ambiguous in his aphorisms so that in trying to figure out what he could possibly have meant, the reader breaks the chains of conventional thinking. As such, while he might have had a specific meaning in mind himself, it's more important what it triggers you to stop thinking; what assumptions it challenges. Like a koan, it's a tool towards your own enlightenment.
In this case, the conventional thinking I think it is supposed to challenge is the idea that only sins should be punished with suffering, that we should seek to avoid or prevent suffering, that the purpose of punishment is so that people seeking to avoid suffering will thus be motivated to avoid sin.
Nietzsche turns this around in multiple ways. He argues that suffering is necessary for greatness, that we should not let fear of suffering prevent us from acting according to our virtues, that the idea of 'punishment' has it backwards.
The greatest virtue is commonly seen in tales of martyrdom. Although the Christian metaphor would probably not be to Nietzsche's taste, we know that in Christian canon Jesus and the saints were punished specifically for their virtues, knowing the consequences in advance, and it is precisely this that makes their virtue so great. On the other side of the argument, Galileo was so lionised in the story because he expected to be punished for sticking to his beliefs. Soldiers are admired for self-sacrifice for the cause - again, suffering for their virtue.
The Free Spirit has to live life to the full, take risks, accept suffering as a price worth paying, and if you're going to be punished, best you be punished for standing tall and doing the right thing.
In 225 of Beyond Good and Evil, the chapter 'Our Virtues' we find:
You want, if possible—and there is not a more foolish "if possible"—TO DO AWAY WITH SUFFERING; and we?—it really seems that WE would rather have it increased and made worse than it has ever been! Well-being, as you understand it—is certainly not a goal; it seems to us an END; a condition which at once renders man ludicrous and contemptible—and makes his destruction DESIRABLE! The discipline of suffering, of GREAT suffering—know ye not that it is only THIS discipline that has produced all the elevations of humanity hitherto? The tension of soul in misfortune which communicates to it its energy, its shuddering in view of rack and ruin, its inventiveness and bravery in undergoing, enduring, interpreting, and exploiting misfortune, and whatever depth, mystery, disguise, spirit, artifice, or greatness has been bestowed upon the soul—has it not been bestowed through suffering, through the discipline of great suffering?
It's one possible interpretation. But don't get too hung up on whether you have identified the right one. I don't think you're meant to figure out 'the answer' and then just stop thinking about it. That's why they're so obscure.
[Except for exams, of course, where your aim has to be to find out how your lecturer interprets it...]