When I say involved I mean things such as state and county election officials conducting events as well as the state footing the bill for the event costs such as poll manager pay, ballot printing, election notices, etc. Intuitively since it's not the presidential election but merely parties selecting their candidates one would think that they would do so on their own. What is the motivation for the government running presidential primary elections and caucuses instead of the Republicans and Democrats doing it on their own ?
It's important to keep in mind that although the presidential race isn't exactly a local race, the primaries and caucuses where it's voted on almost always involve other local or state races and issues to be voted on, and the voters are essentially voting for delegates to represent their state or district at the convention. It's common to think of Republican and Democratic being national parties but they each have affiliates set up in every state. In that respect, these primaries are really state/local elections.
As to why the state governments pay for the elections of the parties, there's a decent article here explaining some of the basics of U.S. primaries/caucuses that mentions:
State governments fund and run primary elections in much the same way they do the general election in the fall. Voters go to a polling place, vote, and leave. The primary election was a Progressive-era reform intended to reduce the potential for mischief in a nomination system controlled by the parties.
A somewhat long and detailed history of the "mischief" mentioned can be found here. Essentially, the parties themselves used to cover the costs encountered from nominating a candidate, but as is often the case in politics, many officials made up rules, bent and changed them, excluded people from the process, and connived about in ways to get certain candidates nominated.
Reforms came about over a long time, but one of the main ways to eliminate the "competition" in a primary and also to pay for the election itself was to require excessive fees in order to be a candidate on the ballot. Along with various Voting Rights laws, states decided that to ensure fairness to voters and integrity to the elections, it would be best for the states themselves to pay for and help oversee the primaries. Bullock v Carter (1972) was a Supreme Court Decision that helped solidify this preference.