Absolutely DO NOT punish your players via health and resources. Taking "tangible" things away from the player makes the players think your game is DM vs. Player, and they will continue to rebel against you. Not only that, when you take away in-game resources without reason, you reinforce out-of-character behavior, rather than focusing their attention on the in-game world. The resources might be in-game but those resources are often as important or more important to players as they are to their characters.
LegendaryDude has rightly questioned this type of punishment,
"It seems odd to me that in order to correct/reduce [out-of-character] activity, that punishment handed out by the GM would also be in a meta-game, [out-of-character] form".
There are better ways to encourage behaviors. We want to reinforce in-game behavior with in-game consequences. We also want to handle it in a fair and balanced way. Let's go with a Carrot and Stick approach.
The Carrot
You're punishing with the stick, but sometimes you need to lead with a carrot instead. What I mean by that is, you need to incentivize behaviors you want them to have. One way you can do this is by awarding bonus role-playing XP at the end of the session. I've had this used on me in the past (as a newish player) and it's a great way to get people engaged and interested because it encourages them to actually try to role-play with mechanical rewards. People that are only interested in rolling dice are more or less forced to be their character if they want to keep up with a player that is role playing. Additionally, this pushes the out-of-character rewards to the end of the session, so it keeps players focused in-game while still utilizing meta-game rewards.
The Stick
Obviously, the carrot doesn't always work, and you've clearly felt the need to use the stick. But, again, don't take mechanical things away from them like gold and health. If your problem is (and please clarify for me) that your characters are discussing things for too long, put them on a timer. "The merchant, annoyed and bored, walks away from this conversation". Oops, they just lost an opportunity. You can treat out-of-character discussion as in-character discussion as well and teach them to be careful of what they say. Make it obvious that when they're talking, they're talking in character and everything they say matters.
Dan Henderson also rightly notes,
The [out-of-character] talk happens because your players are not immersed in the game world. When you subtract gold or health without an in-game reason, you only contribute to that underlying problem. For a punishment to be effective at curbing [out-of-character] chatter, it has to increase immersion, not decrease it.
At the end of the day, it's important to recognize that DnD is a social gathering, and people like to make jokes and talk and it's difficult to remain in character for several hours at a time, and because of this it might be fitting to find a compromise...
Allow Out of Character Discussion Sometimes
You might not like it, but out of character discussion is very handy and helps people from becoming frazzled at playing a character for several hours straight. Allow them to discuss certain things out of character, but make sure there is an appropriate way to do it. I suggest the "hand on forehead" approach. When a player has the top of his hand pressed against his forehead, he is speaking as a player and not a character. This is useful to allow jokes, ask questions, and discuss options about what the players want to do. This can be abused, so you may need to use the stick again and put them on a timer if it goes too far. In my experience, it's incredibly useful to keep everyone on the same page. No more "wait, was that in character or out of character?". You as DM need to treat it as law, so if they make a joke without the hand on the head, they made the joke as a character, so you can react appropriately. In time, they should learn to use it effectively.
Talk to your players
This is basically the number one thing. You and your players need to be on the same page. You seem to want them to play a very immersive campaign where every player is their character. They seem to think otherwise. Before this campaign started, you should have let them know what kind of game you were going to run. Well, it's not too late to have that discussion. Let them know what type of campaign you're going to run and how you're going to run it, what you're awarding, what you're punishing for, etc etc. You're a player too, after all, and you'd like to have fun a certain way. Of course, you could always change the way the campaign is run to suit their play-style, but this is less than ideal.