What this does is force the issue at the federal level. If Montana (or any state) were to ban TikTok (or any app) all they can really do to enforce that ban is to prohibit the sales of phones with the app within their borders and prohibit local ISPs from allowing access to TikTok, which is fruitless in the days of mail order, satellite internet, VPNs, and so on. So now Montana can go to the Federal government about other states making it impossible for them to enforce their own laws.
There are a few reasons they could be doing this, could simply be the standard election season politics and earning points with the locals with legislation that does not have a leg to stand on. It could just be to get it out of the way so they can say Fed has ruled, nothing we can do. Or it could be to force some other related legislation, and probably quite a few other possibilities. You need to dig into Montana politics if you want to figure out their reason.