For some reason I thought this was either an uncov or a dailywtf entry.
Anyway. What I would have done is store the sales tax information in an associative array (ideally stored in a database, but even in a hard-coded include would be okay for starters), and to have the PHP emit the same array’s contents in Javascript format for the client side. It’s not tricky, and it’d be much more efficient for both.
If you later need more intelligent logic (e.g. due to sales tax which varies by type of good – which does exist in many states – or some sort of progressive sales tax which varies by purchase price) then you’d need to update the logic on both sides, but as long as the logic is just a simple multiplication I don’t see the problem with just replicating the parameters instead of the logic.
Also, TECHNICALLY that code isn’t a polyglot – it’s php code which can generate code in both php and Javascript. On the Javascript side it’s not running the same code, it’s running code which was generated by a trivial “code generation” engine.