According to a Wired article whose accuracy I can't vouch for, but which seems plausible, it appears to be your second option, military factories producing them on the side for entertainment/morale, perhaps with a secondary goal of motorvisual-skills training (http://www.wired.com/gaming/hardware/news/2007/06/soviet_gam...):
"From the late '70s to the early '90s, Soviet military factories produced some 70 different video game models. Based largely (and crudely) on early Japanese designs, the games were distributed -- in the words of one military manual -- for the purposes of 'entertainment and active leisure, as well as the development of visual-estimation abilities.'"
"From the late '70s to the early '90s, Soviet military factories produced some 70 different video game models. Based largely (and crudely) on early Japanese designs, the games were distributed -- in the words of one military manual -- for the purposes of 'entertainment and active leisure, as well as the development of visual-estimation abilities.'"