I hear this quite often, but I just wonder if that is hindsight rewriting/spinning the situation? Did the people in charge of Star Wars program know it was a sham and knew from the beginning that's what it was, or were they really trying to build a space based defense program that turned out to be too complicated and too expensive to do?
In reality "star wars" was a moniker applied to several different programs which were part of the Strategic Defense Initiative geared towards missile defense. Part of the Strategic Defense Initiative was the ISTO, which funded basic research at national labs, which included some promising but ultimately impractical technologies - as is typical of basic research. Tech like isomer lasers and particle weapons made headlines, while missile guidance systems and radar systems and other such technologies which were much more seriously pursued didn't. Many of the technologies developed by the SDI remain at the core of modern missile defense systems. In fact, when one looks at the history in context, SDI only started getting wound down when the soviet union stopped being a threat and thus there was no longer a need to stop a large scale nuclear missile strike; while programs got renamed and were refocused on stopping different threats, the work never really stopped. So it would be inaccurate to describe the program as either a deliberate or accidental boondoggle.
That being said, ever since the very beginning of missile defense, it was always understood that the system would never be a permanently impenetrable shield. At best it might take a few years for adversaries to develop a new weapon to get through, but most likely a system would only be able to deal with a portion of targets. But the purpose of missile defense is not to raise the costs for the adversary - if now they have to launch 3 missiles to guarantee a hit where before they needed 1, you've essentially tripled their costs, not including the development of any new technology which could also be considerable. The fact is the Soviet Union did spend a substantial amount on developing technologies to defeat Star Wars, and even today China and Russia are spending significant resources developing technologies like hypersonic missiles to deal with the successor programs. So while the implication that the US purposely pursued technologies it knew would never work to trick the Soviet Union into following suit is not true, the US was trying to hurt its adversaries economically.