South Dakota’s Supreme Court on Thursday struck down a law that would require out-of-state retailers to collect sales taxes on in-state purchases—a defeat the state expected and welcomed in a case that eventually could have national implications for e-commerce.