They treat 'five dollars' as singular because the phrase 'as much as' refers to the 'cost', 'price', 'value' or 'worth' implied in the statement.
'You could pay as much as five dollars' means 'the price you pay could be as much as $5'.
'The value of this product could go up [by] as much as $5'.
The 'as much as' refers to 'the price' or 'the value' respectively.
If you are counting out dollar bills then you could say 'as many as five dollars' because it is the actual dollars themselves to which you are referring.
I hope this helps you to understand this apparent anomaly.