Pope Francis has landed and American taxpayers are footing the bill.

According to the Philadelphia Inquirer, the World Meeting of Families agreed on Friday to shoulder Philadelphia’s costs for hosting the pope. The Meeting is sponsored by the Holy See’s Pontifical Council for the Family and is held every three years in a different world city. This year, it’s located in Philadelphia.

“The contract is backdated Sept. 10 and states that the nonprofit was to have provided the city with a security deposit of $2.5 million on Sept. 14,” wrote the Inquirer’s Brian Moran. The fees will cover various police, emergency, sanitation, and other city services, as well as a license for a papal parade down public highways.

But taxpayers will also incur substantial costs for the pope’s American tour, which will include stops in Philadelphia, New York City, and Washington, D.C.  For example, public funds will be used to pay for millions of dollars in security costs incurred by the Secret Service and other federal agencies.

At Fortune magazine, Michal Addady notes that the federal government typically foots the bill for D.C.’s security needs, but that there’s a real chance the $4.5 million annually budgeted for this purpose won’t be enough to cover the cost of the pope’s visit.

“The cities will be expected to provide certain services that will potentially be reimbursed, but it’s likely that citizens will be stuck paying for a portion,” Addady wrote.

These costs raise an interesting church-state separation question: Is it unconstitutional for cities to subsidize the cost of hosting Francis?

Not necessarily.

Francis belongs to a legal category distinct from that occupied by most other religious leaders because he’s considered a head of state. (Queen Elizabeth II of England also shares that distinction, as she heads the Church of England in addition to her duties as the nominal head of state.)

As I wrote previously for Church & State, the Reagan administration formalized diplomatic ties with the Holy See in 1984. Americans United sued to stop the move, but we were unsuccessful. A federal court tossed the suit on technical grounds.

It’s legal, then, for Francis to address Congress. In fact, religious leaders who don’t moonlight as heads of state have done the same. It’s also most likely legal for public schools to cancel classes for the visit, as some districts have already done, so long as they do so for secular reasons like insurmountable traffic difficulties--and not to encourage children to attend religious events.

But funding is a slightly more complicated matter.

Millions of Catholics are scheduled to descend on D.C., Philadelphia and New York City to see Francis; that’s in addition to a high number of media professionals assigned to cover the event. As we explained in an August 31, 2015 letter to the city and federal officials involved, cities are within their legal rights to use public funds for security concerns and other secular needs, so long as they provide similar funding for comparable non-religious events.

But it is illegal for cities to subsidize religious activity. D.C. can’t fund today’s mass at the Basilica of the National Shrine of the Immaculate Conception, for example; Philadelphia cannot subsidize the World Meeting of Families. The same rules apply to the pope’s activities in New York City.Security and safety costs are the inevitable consequence of hosting a religious figure sacred to 1.2 billion people. It’s entirely proper, though, for the Meeting to reimburse Philadelphia, and it should have done so sooner—especially when experts say the visit doesn’t actually offer much economic benefit to the affected cities.

Francis’ visit is a historic moment for U.S. Catholics. It’s a shame it comes at such high cost to taxpayers.