Strategically, it seems like a dumb move. Right now, Congress is unlikely to approve Trump’s request for $200B to fund the war effort. But if Americans can be convinced that Iran could somehow hit American cities, they would call their members of Congress in a heartbeat and that money would presumably flow without interruption.
Why time the medium range missiles now? It seems like yet another own-goal for this desperate and poorly coordinated regime.
Americans can be convinced of anything without too much effort so that isn’t really a factor here.
Or the US could just stop bombing Iran? Then there would be no reason for Iran to attack American cities.
I can't speak for Iran, but it may be a warning against attempting to land troops on Kharg Island. They're showing that they've been "nice" so far, but they have escalation paths America may not have considered. I think most people thought they were limited to short range missile strikes.