It depends on the type of writing. Like you said, it’s a gray area. Early in my career I ghostwrote a few of those clickbait articles for super low prices and hated every second of it. I refuse to do it again.
On the other hand, I’ve ghostwritten pieces with more substance and more pay and I thoroughly enjoyed it. I really liked learning about the client and pretending to them so I could match their voice. It is a bummer, though, when one of those articles shows up in a major publication and I can’t use it for my portfolio or tell anyone that I wrote it.