The first reason is that many years ago, publishers assumed that if readers knew the "author" didn't write the book, they wouldn't buy it. That's proven false and is no longer a valid argument; however, a few publishers still don't give the ghostwriters credit.
The other reason is that some authors don't want anyone to know they didn't write the books with their names on them. (Take it as a given that most celebrities don't write their own books, even if they don't credit the writer.)
Whenever you see a book with the author's name followed by with and another name, that's a collaboration. It means the author lived the experience, and the other person, known as the writer, did the work of interviewing, writing, and editing the material for the author.
Sometimes people ask about, "as told to," which is now an old-fashioned term. I see it mostly in magazines. It does make sense to use the three words where there is more than one author. For example, years ago, several Kentucky coal miners were trapped in an explosion, and only three survived. A book came out shortly afterward and it listed the names of the surviving miners as the authors followed by "as told to."
Ghostwriting or collaborating demand the same amount of work.
The difference is whether the writer gets credit.