The size of your refund is calculated by a simple formula:
Refund = (amount withheld) + (amount of refundable credits) - (taxes owed)
(This could come out to a negative number, in which case you will have to pay in more money instead of getting a refund, but that's a digression.)
None of those inputs have any influence on each other.** Your refund is just the disparity between the amount you have already given to the IRS (or state agency) for the year, and the amount it turns out you actually owe after going through the complicated steps of the 1040 form.
So, supposed you go through the tax form and find out your tax liability is $8,437 (let's leave credits out of this), and it you actually paid in $11,437 through withholding, your refund will be $3,000. If you had withheld more, your refund would be higher. If you had withheld less, your refund would be lower. Bt your withholding and actual tax liability have nothing to do with each other.
In your case, you actually have 2 refunds which happen to add up to a round number. But these, too, are independent calculations. The federal government doesn't care how much you pay into your state (other than the fact that your state withholding is deductible if you are itemizing, provided you count your state refund as income in the following year), and the state doesn't care what you paid the feds. They each have their own rules for calculating what you owe. The fact that your two refunds combined add to a nice round number is coincidence.
** If you have regular employment, you could argue that the taxes owed influences the amount withheld, as your withholding is supposed to be a projection of what the IRS thinks you will owe according to a calculation using the size of your paycheck and the number of exemptions you claim. It is entirely up to you to declare your exemptions, though, and the actual tax calculation is much more complex than the one used to determine withholding, so it is rare for those numbers to match exactly. But it is to your benefit to get these two numbers as close as possible.