
493 Pa. 254 (1981)
426 A.2d 94
CENTRAL DAUPHIN SCHOOL DISTRICT
v.
AMERICAN CASUALTY COMPANY, Appellant.
Supreme Court of Pennsylvania.
Argued May 19, 1980.
Decided February 4, 1981.
Reargument Denied March 13, 1981.
*255 Leo E. Gribbin, Jr., York, for appellant.
David E. Lehman and G. Thomas Miller, Harrisburg, for appellee.
Before EAGEN, C.J., and O'BRIEN, ROBERTS, NIX, LARSEN, FLAHERTY and KAUFFMAN, JJ.

OPINION OF THE COURT
ROBERTS, Justice.
In this action, appellee Central Dauphin School District seeks to recover $529,000 from its insurance carrier, Appellant American Casualty Company, the amount the district by decree of court has thus far been required to return to its *256 taxpayers against whom the district imposed an unlawful tax.
Under the parties' insurance policy, effective from February of 1973 to February of 1976, appellant agrees
"[w]ith the School District that if during the policy period any claim or claims are made against it as a result of any Wrongful Act occurring during the policy period, [appellant] will pay on behalf of, in accordance with the terms of this policy, all loss which the School District shall become legally obligated to pay."
"Loss," the only term consistently disputed in this proceeding, is defined as follows:
"Loss shall mean any amount which the Assured [(including school board members)] or School District are legally obligated to pay, including, but not limited to, any amounts which the School District may be required or permitted to pay as indemnity to an Assured, for a claim or claims made against an Assured for a Wrongful Act and shall include but not be limited to damages, judgments, settlements and costs, cost of investigation and defense of legal actions (excluding from such costs of investigation and defenses, salaries of officers or employees of the School District or any other governmental body) claims or proceedings and appeals therefrom, costs of attachment or similar bonds, provided always, however, such subject of loss shall not include fines imposed by the law, or matters which shall be deemed uninsurable under the law pursuant to which this policy shall be construed."
Central Dauphin paid a premium of $3939 for this policy, coverage it now contends includes the present claim of $529,000 and any further sums which it may be required to refund as a result of the unlawful tax collection.
By resolution dated June 19, 1974, Central Dauphin imposed a tax on the value of the occupations "of all persons residing in Central Dauphin School District . . . who are eighteen (18) years of age or older." See The Local Tax Enabling Act, Act of December 31, 1965, P.L. 1257, § 2, as amended, 53 P.S. § 6902 (1972). After levy and collection, *257 certain taxpayers of the district instituted proceedings in the Court of Common Pleas of Dauphin County challenging the validity of the district's resolution. Nowhere does the record indicate that Central Dauphin gave appellant notice of the proceedings. The court of common pleas struck down the measure insofar as it sought to impose an occupation tax on "retired persons, housewives and others who have not or do not engage in a gainful occupation . . .," and directed payment of refunds. Peifer v. Central Dauphin School District, 97 Dauph. 199, 70 D. & C.2d 35 (1975).
Central Dauphin took no appeal and the trial court's decree became final. Thereafter the district began to return the tax funds unlawfully collected to those taxpayers who made refund claims under the Act of May 21, 1943, P.L. 349, § 1, as amended, 72 P.S. § 5566b (1968).[1]
Central Dauphin then sought from appellant an amount equal to the tax revenue it had illegally collected and was required by court order to return to its taxpayers. By letter dated May 22, 1975, appellant took the position that no "loss" had occurred within the meaning of the parties' insurance policy. Appellant advised Central Dauphin that
"it is doubtful if this event can be insured. Our `loss' definition does have language which says that matters which shall be deemed uninsurable under the law pursuant to which the policy shall be construed are not to be considered part of `loss.'"
*258 Upon appellant's refusal to make payment, Central Dauphin filed the present action seeking the $529,000, the amount of tax refunds so far paid, "together with an additional sum for further refund claims that may be filed with and paid by [Central Dauphin] prior to trial . . . ." After a nonjury trial, the court of common pleas entered judgment in favor of Central Dauphin. A panel of the Superior Court affirmed, 271 Pa.Super. 218, 412 A.2d 892 (1979), and this Court granted allowance of appeal.
Central Dauphin relies heavily upon the initial portion of the policy's "loss" clause, which defines a loss as "any amount which the Assured or School District are legally obligated to pay . . . ." It is axiomatic, however, that "[t]o determine an agreement, a writing must be interpreted as a whole, giving effect to all its provisions." Atlantic Richfield Co. v. Razumic, 480 Pa. 366, 372, 390 A.2d 736, 739 (1978). The concluding portion of the "loss" clause specifically excludes from the definition of loss those matters "which shall be deemed uninsurable under the law pursuant to which this policy shall be construed." Thus the writing makes clear that not every legal obligation is within the scope of the present insurance coverage. Expressly excluded from coverage are those matters "deemed uninsurable."
"In general, parties may contract as they wish. . . ." Restatement (Second) of Contracts Ch. 14 (Unenforceability on Grounds of Public Policy) Introductory Note, p. 46 (Tent. Draft No. 12, March 1, 1977). At the same time, however, freedom of contract is not absolute. "A promise or other term of an agreement is unenforceable on grounds of public policy if legislation provides that it is unenforceable or if the interest in its enforcement is clearly outweighed in the circumstances by a public policy against the enforcement of such terms." Id. at § 320(1) (When a Term is Unenforceable on Grounds of Public Policy). See also id. at § 233 (Construction Favoring the Public) (Tent.Draft No. 5, March 31, 1970).
*259 In our judgment, the public policy of this Commonwealth would be offended by permitting a political subdivision to use public funds to purchase "insurance" against court-ordered and statutorily-mandated refunding of taxes collected through an unlawful taxing measure. Were Central Dauphin's position to prevail, a school district or any other taxing body would have little reason, if any, to enact only lawful taxing measures. A district would be able to subject its citizens to an unlawful tax measure like the one imposed here, and yet in effect retain the proceeds of the unlawful tax simply by recovering on the claimed insurance coverage.
Neither statutory authority nor our case law permits a device by which a school district's enactment of an unlawful tax provides the district with the same amount of revenue as if the tax were lawful. School districts may obtain revenues only from lawful taxing measures and legislative appropriations, not unlawful taxation and insurance proceeds. Where an unlawful taxing measure is imposed, a district is obliged by court order and statute to return the unlawfully collected funds to taxpayer-claimants. Refunds are to be paid "out of budget appropriations of public funds. . . ." Act of May 21, 1943, P.L. 349, as amended (supra note 1). So too, under the Public School Code of 1949, Act of March 10, 1949, P.L. 30, § 631(6), as amended, 24 P.S. § 6-631(6)(Supp. 1980), a district may create and incur indebtedness "[t]o pay any refund of taxes decreed by an order of court. . . ."[2]
Central Dauphin argues that, in enacting its unlawful taxing resolution, it acted in good faith and that it was *260 guilty only of "negligence" in failing to pass a lawful taxing resolution. This degree of fault, Central Dauphin claims, is within the scope of the policy coverage.
Even if Central Dauphin were only "negligent," the consequences of the unlawful tax may not be avoided by the assertion of insurance coverage. Such an assertion contravenes constitutional and statutory requirements. The validity of tax measures is not determined by the good or bad faith or negligence or lack of negligence of the governmental unit imposing the tax. Taxation is a governmental function controlled by constitutional provisions and statutory direction. The exercise of this function must strictly comply with constitutional and statutory controls. See Amidon v. Kane, 444 Pa. 38, 41-42, 279 A.2d 53, 55 (1971); Madway v. Board for Assessment and Revision of Taxes, 427 Pa. 138, 146, 233 A.2d 273, 277 (1967). See also 1 Pa.C.S. § 1928(b)(3); McQuillin, 16 Municipal Corporations Ch. 44 (Taxation), §§ 44.13 & 44.16 (3d ed. 1979).
Because this Commonwealth's public policy does not permit a school district to make unlawful taxation just as revenue-productive as lawful taxation, it must be concluded that a political subdivision's return of tax monies to its taxpayers collected by an unlawful tax is uninsurable. Hence there has been no "loss" within the meaning of the insurance policy and no claim lies against appellant. Accordingly, the order of the Superior Court must be reversed, and judgment must be entered in favor of appellant.
Order reversed and judgment entered for appellant.
EAGEN, former C.J., did not participate in the decision of this case.
LARSEN, J., joins the Opinion of the Court and files a concurring opinion.
KAUFFMAN, J., files a dissenting opinion.
LARSEN, Justice, concurring.
I concur in the majority opinion.
*261 First: It offends public policy for a school district to purchase insurance against tax refunds. Even if an insurance company willing to write such a policy could be found, the premium payments would be a frivolous waste of tax dollars.
Second: I agree that the insurance policy provision which excludes matters "uninsurable under the law pursuant to which [the] policy shall be construed" applies to tax refunds. I submit that even without relying on this exclusion, the tax refund is not covered by the policy for the following reasons:
Where the language is clear and unambiguous, the terms of an insurance contract are to be given their plain and ordinary meaning. Pennsylvania Manufacturers' Association Insurance Co. v. Aetna Casualty and Surety Insurance Co., 426 Pa. 453, 233 A.2d 548 (1967). The policy clearly and unambiguously insures against "loss". If it is found that a tax has been illegally collected from some taxpayers and is refunded, any shortage in necessary funds will be collected from other taxpayers, since the source of the school district's funds is the taxpaying public. To claim that this resulted in a "loss" to the school district would defy common sense; it would disregard the plain and ordinary meaning of "loss".
The statute which governs the refund of taxes in this case is the Act of May 21, 1943, P.L. 349, § 1, as amended, 72 P.S. § 5566b (1968). This act provides that whenever a political subdivision (including a school district) has collected taxes to which it is not legally entitled, any taxpayer entitled to a refund must make a written claim within two years.[1] The *262 statement that the "political subdivision is not legally entitled" to the taxes as well as the use of the word "refund" in the statute supports the conclusion that the school district has not suffered a "loss" when the taxes are refunded. The school district simply cannot "lose" that to which it was not legally entitled.
In his dissent, Mr. Justice Kauffman urges that the tax refund is a "loss" because the policy defines "loss" in unusually broad terms as "any amount which the Assured or School District are legally obligated to pay . . .". Despite the broad terms, there is absolutely no indication that a peculiar meaning be given to the word "loss". In fact, the examples which follow the definition are garden-variety "losses": "damages, judgments, settlements and costs, cost of investigation and defense of legal actions . . ." etc. The language of the policy does not require that an eccentric meaning be given to the word "loss", and permitting the school district to recover the amount of the refunded taxes from the insurance company would disregard the plain and ordinary meaning rule set forth in Pennsylvania Manufacturers' Association Insurance Co. v. Aetna Casualty and Surety Insurance Co., supra.
KAUFFMAN, Justice, dissenting.
This is an appeal from an order of the Superior Court affirming an order of the Court of Common Pleas of Dauphin County imposing liability upon appellant, American Casualty Company, pursuant to the express language of its policy of insurance with the Central Dauphin School District ("School District").[1]
In 1974, School District adopted a resolution imposing an occupations tax on all persons in the district eighteen years of age or older. On March 14, 1975, the Court of Common Pleas of Dauphin County declared the tax invalid as it applied to persons not engaged in a gainful occupation, e.g. *263 housewives and retirees,[2] and imposed a legal obligation upon the School District to refund the amounts paid by those housewives and retirees who submitted written claims in accordance with the Act of May 21, 1943, P.L. 349, § 1, as amended, 72 P.S. § 5566b. Pursuant to this order, the School District made payments totalling $529,000, and promptly sought reimbursement for this amount from appellant under its policy. Conceding that adoption of the defective tax was a "Wrongful Act" as defined by the policy, appellant nevertheless denied the claim on the ground that refund of illegally collected taxes was not a "Loss" as contemplated thereunder.[3]
Appellant's initial policy provided protection for the school directors and employees of the School District for "Loss" resulting from their "Wrongful Acts."[4] The School District itself was covered only to the extent it was required to indemnify an "Assured" for loss caused by an "Assured's" actions. The policy was amended by a Liberalization Endorsement, however, which extended coverage to the School District:
[I]f during the policy period any claim or claims are made against [the School District] as a result of any Wrongful Act occurring during the policy period, the Insurer will pay on behalf of [the School District], in accordance with the terms of this policy, all loss which the School District shall become legally obligated to pay. (Emphasis supplied)
*264 The School District asserts that its policy covered the payment of the $529,000 it was obligated to make since its broad language drafted by appellant provides coverage for any incident of a "Wrongful Act" resulting in a "Loss." Appellant, on the other hand, now argues that the School District neither committed a "Wrongful Act" nor sustained a "Loss." The express and unambiguous language of the policy leads inexorably to the conclusion that appellant agreed to indemnify the School District for all sums it was legally obligated to pay in response to tax refund claims.

I.
A contract of insurance must be read in its entirety, and, when the language is clear and unambiguous, its terms must be given their plain and ordinary meaning. Pennsylvania Manufacturers' Ass'n. Insurance Co. v. Aetna Casualty and Surety Insurance Co., 426 Pa. 453, 233 A.2d 548 (1967). Even if genuine ambiguities did exist, they must be resolved in favor of the insured and against the drafter of the contract. Mohn v. American Casualty Co., 458 Pa. 576, 326 A.2d 346 (1974); Treasure Craft Jewelers, Inc. v. Jefferson Insurance Co. of New York, 583 F.2d 650 (3rd Cir. 1978). "Wrongful Act" and "Loss" are specifically defined by the policy in clear and unambiguous words, and must, therefore, be applied as contractually defined.
"Wrongful Act" is defined as follows:
Wrongful Act shall mean any actual or alleged errors or misstatement or misleading statement or act or omission or neglect or breach of duty by the Assureds in the discharge of their duties, individually or collectively, or any matter claimed against them solely by reason of their being or having been Assured during this policy period. (Emphasis supplied)
Since this broad definition includes "any actual or alleged errors . . . or act . . . or neglect . . . by the Assureds [the school directors] in the discharge of their duties individually or collectively," and since the Liberalization Endorsement covers any "Wrongful Act" which results in a legal obligation *265 of the School District to pay, adoption of a defective tax ordinance and collection thereunder clearly falls within the scope of "Wrongful Act" as defined by the parties in their written agreement.
Appellant claims, however, that the School District suffered no "Loss" in refunding taxes improperly collected because this was not a loss within the ordinary meaning of that word. Here, however, the policy drafted by appellant expressly defines "Loss":

Loss shall mean any amount which the Assured or School District are [sic] legally obligated to pay, including but not limited to, any amounts which the School District may be required or permitted to pay as indemnity to an Assured, for a claim or claims made against an Assured for a Wrongful Act and shall include but not be limited to damages, judgments, settlements and costs, cost of investigation and defense of legal actions . . . claims or proceedings and appeals therefrom, costs of attachment or similar bonds, provided always, however, such subject of loss shall not include fines imposed by the law, or matters which shall be deemed uninsurable under the law pursuant to which this policy shall be construed. (Emphasis supplied)
Thus, the only question is whether the School District was under a legal obligation to pay the $529,000 which it refunded to housewives and retirees. As the Superior Court correctly noted,
Appellee school district, by virtue of the equity decree invalidating portions of the tax resolution, was obligated by law to refund tax money upon written demand by exempt taxpayers. . . . It is clear that the school district was legally obligated to pay the amounts demanded by exempt taxpayers; and, under the terms of the policy, such payment was defined as a loss.
271 Pa.Super. 218, 412 A.2d 892, 895-6 (1979). Accordingly, I would hold that the School District has sustained a "Loss" within the clear and unambiguous policy definition.
*266 Since the enactment and collection of the defective tax was a "Wrongful Act" which resulted in a "Loss," as defined by the policy, appellant's agreement with the School District obligates it to pay the amount refunded.

II.
Appellant argues that tax refunds are uninsurable by law because the Public School Code ("Code")[5] does not specifically authorize this type of insurance. Thus, in appellant's view, refunds are excluded from coverage because the policy definition of "Loss" excludes matters uninsurable under existing law. I disagree. Nothing in the Code suggests that the list of permissible insurance contracts set forth therein is exclusive, and I am aware of no statutory prohibition of the purchase by a school district of the type of insurance expressly provided by the policy here under consideration.

III.
Finally, appellant argues and the majority agrees, that enforcement of the insurance contract as written would contravene public policy. Undoubtedly, if the direct purpose of an insurance contract were to promote, encourage, or effect a violation of law or if the insured sought indemnity for loss arising from his or her own intentional, fraudulent, reckless, or criminal conduct, public policy would preclude enforcement. See 9 Couch on Insurance 2d 39: 14-15 (1962). Cf. Mineo v. Eureka Security Fire and Marine Ins. Co., 182 Pa.Super. 75, 125 A.2d 612 (1956). However, there is not a scintilla of evidence of bad faith on the part of the School District in entering into or attempting to enforce the insurance contract. Nothing in this record indicates, nor does appellant even suggest, that the School District was motivated by anything but good faith and the public interest. That being the case, I would apply ordinary principles of contract interpretation and enforce the contract as written by appellant.
*267 In expressing its belief that enforcement of this insurance contract will encourage a taxing body to obtain revenues by intentionally enacting unlawful taxing measures and then recovering under its insurance policy, the majority artificially creates a straw man. A decision to enforce the clear terms of this insurance contract under the conditions here presented would have no such effect. It would neither condone nor encourage bad faith abuse of insurance contracts for the plain reason that bad faith has not even been suggested here. Moreover, appellant, who freely agreed to all the terms of the contract which it drafted, is free to rewrite future contracts to exclude the coverage now asserted by the School District.
Accordingly, I would hold that public policy is not violated by the insurance policy in this case and that the imposition of liability upon appellant would simply give effect to the clear and unambiguous language of the insurance contract.
NOTES
[1]  The Act of May 21, 1943, as amended, provides:

"Whenever any person or corporation of this Commonwealth has paid or caused to be paid, or hereafter pays or causes to be paid, into the treasury of any political subdivision, directly or indirectly, voluntarily or under protest, any taxes of any sort, license fees, penalties, fines or any other moneys to which the political subdivision is not legally entitled; then, in such cases, the proper authorities of the political subdivision, upon the filing with them of a written and verified claim for the refund of the payment, are hereby directed to make, out of budget appropriations of public funds, refund of such taxes, license fees, penalties, fines or other moneys to which the political subdivision is not legally entitled. Refunds of said moneys shall not be made, unless a written claim therefor is filed, with the political subdivision involved, within two years of payment thereof."
* * * * * *
[2]  Section 631(6) of the Public School Code of 1949, as amended, provides:

"The board of school directors in any school district may, in any year, create and incur an indebtedness against such school district and issue bonds to secure the same, payable as provided by the act of July 12, 1972 (Act No. 185), known as the `Local Government Unit Debt Act,' or any amendment or re-enactment thereof, for any or all of the following purposes:
* * * * * *
(6) To pay any refund of taxes decreed by an order of court. . . ."
* * * * * *
[1]  Under 72 P.S. § 5566b the taxpayer who does not make a written claim within two years cannot get a refund. However, this does not indicate that the funds belonged to the school district after all, and that any refunds actually made were "losses". The statute merely prescribes a refund procedure which must be strictly adhered to. The cases construing this statute do not conclude that the political subdivision owned any unclaimed funds but instead conclude that the taxpayer failed to observe the statutory refund procedure. See: Pittsburgh Coal Co. v. Forward Township School District, 366 Pa. 489, 78 A.2d 253 (1951); Box Office Pictures, Inc. v. Board of Finance and Revenue, 402 Pa. 511, 166 A.2d 656 (1961). (The refund procedure has to be adhered to even where the taxing statute was unconstitutional.)
[1]  Central Dauphin School District v. American Casualty Company, 271 Pa.Super. 218, 412 A.2d 892 (1979).
[2]  Peifer v. Central Dauphin School District, 97 Dauph. 199, 70 Pa.D & C.2d 35 (1975).
[3]  In a letter dated May 22, 1975, appellant's authorized representative stated that "the action of the Board on June 19, 1974, [the enactment of the tax resolution], amounted to an error which brings the act within our definition of Wrongful Act. The action of the Board was found to be erroneous when tested in the courts, and, therefore, the action meets the definition of Wrongful Act of our policy."
[4]  The policy defined "Assureds": "All persons who were, now are or shall be employed by the School District and shall also include student teachers and all elected or appointed members of the Board of Education, Trustees or School Directors of the School District."
[5]  Act of March 10, 1949, P.L. 30, 24 P.S. § 1-101 et seq.
