I sometimes work as a ghostwriter/editor for other researchers alongside my own research, and it occurred to me that there isn't a clear framework for crediting this work. I have sometimes appeared in the acknowledgements for writing the first draft or completely rewriting the manuscript, or been a co-author on manuscripts I only commented on or did a tiny bit of data analysis for.
On the one hand, if the editor is employed to edit the language of the manuscript only, I don't think that they should be co-authors. But should they appear in the acknowledgements? Does this depend on whether they were paid specifically for the project or are a departmental editor?
On the other hand, if the editor contributes scientifically to the manuscript, perhaps they should be co-authors. However, does this depend on whether the manuscript is basic research or (for instance) an opinion paper? In this case, how do they differ from a reviewer who comments on the substantive aspects of the paper?