… but why, economically, does subsidizing farms result in a more efficient allocation of resources?
It’s doesn’t.
Agricultural subsidies in the US, and I presume most states but I’m not as well read on their policies, are a mixture of realpolitik, war preparedness, and graft.
If you are trying to square the circle, you can’t, because economic efficiency was not an input for the decisions on these subsidies.