The idea that you can mean something "in a good way" or "in a bad way" is similar to the idea of the connotation of a word or phrase: something suggested or implicated beyond its essential or primary or literal meaning. But the connotational difference between "strong-willed" and "pig-headed", or "thrifty" and "miserly", is a more or less fixed property of the words involved.
Meaning something in a good or a bad way, on the other hand, is seen as a choice that the speaker or writer can make. The commonest case seems to be for someone to say something that would most naturally be taken as bad, adding that "I mean that in a good way"
This addendum of course is often ironic, and perhaps especially so if presented in the superlative form "I mean that in the best possible way". Negative forms are fairly common as well, e.g. "I don't mean that in a good way", "I mean that in the worst possible way", etc.
There's also a set of ways for the recipient of a message to add a perhaps-unexpected evaluation — "I take that as a compliment", and so on.
I don't think that there's a linguistic term of art for the phenomenon of asserting that a non-obvious emotional valence is to be imposed on messages sent or received. And as a matter of historical stylistics, I wonder where and when the specific class of phrases like "I mean that in a good way" arose.