There are two factors that can be found from the first graph.
If a state has a high cost of living, K-12 education will tend to be more expensive.
If a state spends a lot, neighboring states will have to spend more. Pennsylvania has many low cost areas, but it needs to spend a lot to keep up with New York State.
Why? Arizona is at the bottom of the chart. California is more than half way up the chart, and it is next door.