Okay well then no, you don't get overflow production. Sorry about that. However, a Google search turned up an interesting six-years-old post about the 1.1 patch which mentions that overflow production should be reimbursed. I don't know for sure that it is even after reading the exhaustive 1.1 release notes so, you'd have to experiment with it to see if that's the case.
Of course, your ledger and planet screen spending figure may only reflect what happens if production is fully used this turn. Your actual change in treasury from this turn to the next will, if that post is correct, mean that you don't pay for wasted hammers.
This is also necessarily true when you aren't producing anything on a planet. Though you still pay maintenance on your structures, any military or social funding that simply isn't being used gets refunded. However, going from producing something to idle is not immediately reflected in the planetary spending total or the ledger, you have to end turn for it to update.
Idle colonies are inefficient, of course, but warships cost money in maintenance and transports suck up population. It does feel like sometimes I'm paying money to build more things that suck money.