A ghostwriter in rap is the same and does the same as any other type of ghostwriter. They are hired to write lyrics for a musician or artist who either doesn't have the time, can't write lyrics, or just doesn't want to. As ghostwriters are often uncredited for their work, and with the negative stigma attached to not writing your own bars, it's pretty common for rappers to deny that they've ever used one.