Here is a neater solution:
On the calculations tab, create a new calculation:
Calculation: floor(([Price] * [Quantity])/500) * 25
then on the discount, set the trigger as outlined in the Coupon code recipe, and set the calculation to "based on Column Subtotal":
Subtotal of column 'every500' 'plus' '0'