Usually when a ghostwriter is hired, it's because the name of the person credited with the writing has a lot of selling power, typically because they're a celebrity from another field, like a rock star or TV/youtube personality, but they don't have much writing skill, or they're not skilled at writing comic scripts (a highly specialised type of writing). Often though, the ghostwriter is credited as an "editor" and their role is framed as having been helping put the "writer's" ideas into comic format and making suggestions, gently bending the truth that actually the person took a bunch of disordered ideas and bad dialogue and made it into something actually readable.
Ghost artists in comics aren't unheard of, but they're rarer. Usually either there's no artist credit because the work in question is a big IP (usually a cartoon or toy franchise) where the artist just draws to a model sheet, or a more well-known artist is credited but most of the work is done by an uncredited assistant.
Ghost writers and artists are pretty common in publishing, because a lot of people will buy things based not on the quality of the work, but on the name or names on the cover, and often famous names are stretched thin or just don't actually have the skill to live up to the kind of professional polish needed. I was amazed by just how widespread the practice was when I started working at a company that makes a book franchise. Even my own day job contract forbids me from saying whether or not I've worked on the books, and if I have, what I contributed, because in the UK and US a contract can force a creator to waive moral rights of authorship and transfer them all to the company or CEO's name.