Ghostwriting does happen and in music publishing I have heard it used for both writing under a pseudonym or not being credited. It can happen for a lot of different reasons, such as the ones I mentioned before. But yes a writer may accept a flat sum and not receive a credit. Often they will get an advance so it's not true that royalties are their only source of income. It can also happen if the writer is inexperienced and signed a really shitty contract or maybe for some sort of 'political' gain ghostwriting can have for their career. Who knows what the deal is with Tinashe. She's not credited on 'I Luh Ya Papi'. But I think it's quite common for there to be disputes over who wrote a song if its gone through several incarnations and concepts are reused without the exact same words. The music business is super shady as we all know.