I like to think of a punt that doesn't cross the line of scrimmage as K's ball and still part of the down. It's not really a 'punt' yet as to how we normally think of a punt. Because before it has crossed the line of scrimmage, K can legally catch this 'punt' and advance it like a forward pass. If the ball is caught or recovered after hitting the ground, we don't treat the 'punt' as a regular punt, but rather the same outcome as fumble by K recovered by K that can be advanced. And since this is still part of the down, K needs to get to the first down marker to get a first down. If the 'punt' was done on 4th down, if K doesn't get to the first down marker, it's the same as any other non-punt play, it's now R/B's ball. If the 'punt' was recovered before the line of scrimmage was done on 3rd down, then the next down is 4th down.
Once the kick crosses the line of scrimmage, now this 'punt' is treated like a normal punt we all know... where R can muff it, R can fair catch it, can be downed by K, etc.
This is one of the reasons a wingman waits until the punt has crossed the line before moving downfield. Once I move downfield, the weird before the line of scrimmage punting rules are gone. While I stand there, those weird rules are in effect.
And if the punt goes downfield, then somehow comes back behind the line of scrimmage, those rules do NOT go back into effect like passing rules do.
Example: K 4th and 10 at K20. K punts the ball to the K25, which then bounces off the ground and rolls back to the K19. K CANNOT pick the ball up to try to gain yards. Once K picks up the ball, they have 'downed' the ball. The before-the-line-of-scrimmage rules aren't available anymore.
Example: A 4th and 10 at the A20. A runs the ball to the A25, reverses course back to the A19. A can now legally pass the ball if they'd like. Legal forward passing is now available again.