While you’re right term “hack” was used in a “positive” sense with regards to model railways, “hack” in the context of computers wasn’t. In the earliest days at TMRC it was used with regards to gain unauthorized access on MIT’s computer systems (although with less negative connotations then it has now). The modern geek “hacker” sense which is in common use now of an elite programmer didn’t come around until much later.
Saying that, if you read the descriptions of "hacks" given in the wikipedia article most of them would now be considered "black hat" under modern definitions anyway.