Can my school fire me on the grounds that I have applied to another school?
Not a direct answer since I can’t presume to know what someone else would do, but you have several misconceptions about how university departments think and act, and maybe understanding them would help guide your thinking. Departments are quite used to spending money on “nothing” — your derogatory but totally inaccurate term for students who leave without completing their degree. From the department’s point of view that’s a completely normal and predictable part of the cost of running their operations, and nothing to get worked up about.
Second, a student who leaves without a degree is in no sense a waste of time or money. Such a student came, gained some useful knowledge, learned some things about themselves that made them a wiser person who is better able to fulfill their potential in the future, and left to go somewhere else. Degree or no degree, the resources spent on such a student are entirely consistent with the mission of a university.
Third, donations are to be given because you have a genuine desire to give money rather than out of a sense of duty, coercion, or a fear of retaliation. If those are your motives, then it’s not donation, it’s extortion.