The other answers are already pretty good but I see OP is having a little bit of confusion still so I will try to take a stab at it.
First part: [...]is grammatical when used contrasting[...]
Let’s take it from the opposite POV first:
Is ungrammatical and grating to the ears, as would the opposite be (他是个坏的朋友).
So, like in music this is our dissonance - by itself it is not okay, but it can be resolved.
So how do we use the idea of musical resolution to be turn our dissonance in to consonance? Comparison.
他是个好的朋友 alone is just nosie but we can compare it:
and now we have a grammatically and audially okay sentence.
This may slightly change the meaning though.
Part two: OP wrote:
The author states in another article "It may be all right to use 好的朋友, meaning ‘a friend who can bring some positive inﬂuence/beneﬁts.’ But it does not mean ‘a good friend’, as 好朋友 a good friend can be a bad friend 坏朋友" I do not undertand how "好朋友 a good friend can be a bad friend 坏朋友". Could you please try to clarify that point?
What are the neuances at play here?
Your buddy (好朋友) could have a corrupting influence over you - objectively he couldn’t be considered a “good quality” friend (好的朋友) but would be thought of as a bad friend (坏朋友).
You can also take a look at the word: 损友.