Probably was both. NASA got a COTS component for their seismologic experiment, saving some time/budget on R&D, and military got to have a grenade launcher tested on the Moon, providing data for whatever "future warfare" programs they were surely running back then.
That is what we call plausible deniability.
(Everyone complaining about this topic inviting jokes, and I’m the first to have posted one. Drama sells more than silly jokes these days.)
Never know when you need to seismically image some hostiles for scientific verification of threat elimination.
I think these days we call this "synergy"?
IIRC the "claymore on a stick" option looked the best back then.