A team should never punt. But I can see reasons for punting between the opponent's 40 and 50 yard lines if it's greater than 5 yards for a first.
What I cannot see is punting from inside the opponent's 40 yard line, especially if that team has a punter that all he ever does is boom it through the end zone from there. Really? You voluntarily gave up the ball in good field position all so you could net 15-20 yards of field position? And even if the second best case scenario happens and you hold them to a 3-and-out, you're still going to lose 20-30 (or worse) yards on the exchange?