As I see it, punishment crops up (pun intended) in different aspects of bd(ds)sm, hence the possible confusion and need for discussion:
Discipline:
This is the means by which one person seeks to modify the behavior of another whether in training or as part of an ongoing (Ds) relationship. Punishment (which often involves pain but not necessarily) is the tool by which behaviour is controlled in the bdsm model. Sort of a carrot and stick principle but with no carrot. In this aspect punishment should not be enjoyed by the sub since that would encourage misbehaviour or misdeeds and defeat the object of modifying behavior.
Domination & Submission:
The Dom having, and being acknowledged to have, the right to punish is considered a demonstration of the Dom's domination of the sub and the sub's acceptance therof. Here it does not matter too much whether or not the sub enjoys the punishment. What is critical though is that the sub acknowledges the Dom's right to punish and willingly accepts the punishment as demonstration of his.her submission to the Dom' s will, authority and power.
Sadism & Masochism:
No reason is needed to say whip a person, you do it for the pleasure alone. But because bdsm has morphed from being a collective term for various separate sexual interests into a single "packaged product", tops and bottoms have largely disappeared and merged into the roles of doms and subs. Strictly speaking it is possible for a Dom to be bottom and vice versa but because this is relatively uncommon in practice, it is now commonly assumed that the Dom is the top and the sub the bottom. When the sub deliberately misbehaves and the Dom gives the punishment they both enjoy, they are in fact being top and bottom and simply finding a bogus punishment reason in order to stay within the Ds and Discipline models. (I didn't exxplain that well but I think you get the gist). If the punishment is in play or in a light hearted manner then Ozme's post explains that situation well.
By putting different aspects into the bdsm melting pot to produce a soup with all the different flavours mixed together, we often lose sight of the individual flavour of each ingredient.
Just my tuppence worth!