For RPGs they almost always outsource the writing. Crafting a good story is not really a skill that a lot of the major developers have a lot of call for (normally they just have you shoot the bad guys because) so they don’t have people on staff for it. In RPGs stories are a lot more important though, so they actually have to put some effort in.