Articl2, section 1 of the US Constitution:
Each state shall appoint, in such manner as the Legislature thereof may direct, a number of electors, equal to the whole number of Senators and Representatives to which the State may be entitled in the Congress: but no Senator or Representative, or person holding an office of trust or profit under the United States, shall be appointed an elector.
Why are Federal Judges involved?
Lawyers $$$$$$$
Hypothetically, a state could have an election for its legislature. State law would require the legislature to appoint the electors. Then there would be no effect by voters directly on the electors just through their elected representatives.