Deleted my previous comment as it didn't directly address your question. I don't know all the history behind it, but in terms of "can", I'm assuming that no, parties were unable to effectively hold a closed primary in a way that was well-run and accessible. And a poorly run primary vote defeats the purpose of having any primary in the first place. Using the state infrastructure and schedule makes the voting process much easier for the average voter, without being a burden to the state political parties.
As to "why" the government should feel obligated to subsidize the process -- because the government has the ostensible goal of facilitating fair and proper elections, and presumably the primary process -- which is not Constitutionally-enshrined -- is a net benefit to the general election, at least compared to selection-by-party-convention. In the future, political parties may decide that it's better to have open primaries, but that's orthogonal to the government providing the voting infrastructure and logistics.