Writing a book takes time. A lot of time. Up to or more than a year depending on the subject matter. Not everyone has that kind of time to devote to share their ideas in print. Not everyone has the patience to set pen to paper--or fingers to keyboard as the case may be. That is where a ghost comes in handy.
Ghostwriters can share credit nor not, depending upon the contract.
Writing columns and blog posts may not take as much time, but there, too, time may be dear and the talent may not meet editorial standards. Again, a ghost can step in to take on the recurring task.
Contracts are negotiated and signed before any work begins. Retainers are required for large projects and new clients. Shorter projects require half payment up front before work begins. Pricing is based on current rates as published by the National Writers' Union, American Society of Journalists and Authors, and Writers' Market.