Interesting situation. If you were to apply legal terms, if a bank accidently credits your account and you spend it, you have to give it back. As I see it you have 4 options:
1. Tell them to shove it as it was their mistake and get blown to kingdom come.
2. Plead ignorance and offer to pay back the money in affordable installments (which shouldn't be an issue if you've used the 3 mil to increase the size of your nation) and stay independant.
3. Apply to the alliance involved as part of the deal and offer to pay the money back in affordable installments, possibly including any of the aid they may have given you for joining.
4. Apply to another alliance, declare the situation and ask them to negotiate on your behalf.