The concept of Mastermind goes back to parlor games like
Bagels
and Bulls and Cows.
The first computer
implementation of the latter was moo,
a PL/I program
by J. M. Grochow.
In its current form, it was invented in 1970 by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert. He failed to interest the big game companies, but finally Invicta Plastics, a small toy manufacturer in Oadby, decided to produce it. They sold over 50 million sets and made Meirowitz a fortune.
In 1977, Donald Knuth analyzed Mastermind and demonstrated that any code can be cracked in a maximum of five moves.
Mastermind was very popular on the 8-bit platforms, especially, it seems, on the Commodore 64 (compare the number of C64 Masterminds with the number of Atari Masterminds). But then there were erotic Mastermind implementations for Atari, like Miss Mind or Sexy Six, which I haven't found for other platforms yet.
The enthusiasm did not carry over into the 16-bit era. In the 90s, Mastermind, like Black Box and Missile Attack, was popular on one platform only: Windows. But there it was very popular, and spawned more implementations than the other two concepts.