To be clear, the Sam's Club® Mastercard® and the Sam's Club® Store Card are two separate and distinct financial tools. The Mastercard has no restrictions on spending outside of the warehouse club since it is a "open-loop" card. The Sam's Club Credit Card is a non-rewards credit card that may only be used at Sam's Club and Walmart.
A Sam's Club card cannot be used at Costco since only Visa cards are accepted there. It offers 3% cash back on eating out and ordering takeout, but just 1% cash back on everything else, including purchases made at Sam's Club.
Sam's Club made it so that loyalty cards stored in the Scan & Go app are automatically linked to your SamsClub.com account. To put it another way, if you have a credit card stored to your S&G account, you may use it at SamsClub.com, and vice versa.