But you are of course right, it's not possible to simply move to Germany just to receive treatment under health insurance. To become member of a health fund you need to fulfil certain conditions, e.g. by starting employment. This applies even to German citizens moving from abroad.
The reasoning goes, it seems, that only bona fide citizens of (say) California will consume welfare in California (you don't move to California to consume California welfare benefits in Ohio). But college education benefits are "portable"; you could conceivably move to California solely for the purpose of accumulating the benefits of a UC education, then take it back with you to Ohio.
Further, the way in-state tuition benefits are structured, the residency requirement is (supposedly) carefully tailored to address just that scenario, by imposing relatively short durational requirements on residency, rather than evidence of permanent residency.
It's tricky to piece out how health care would fit into this rubric. Depending on the condition, you might move to California to benefit from their health care and return to Ohio when you're cured, or you might need to stay in California indefinitely to treat a manageable illness.
Countries like Germany don't have this problem because they have the power to control their borders. Accessing Germany's healthcare system requires being a German resident. That, in general, requires applying for immigration, which the government may or may not grant. EU citizens can, of course, become German residents without applying for immigration, but every EU state has universal healthcare so there is no incentive to free-ride.
And there's a push within Germany and other countries to limit access to welfare benefits for new residents, even ones from other EU countries: https://www.theguardian.com/world/2016/oct/12/german-governm.... U.S. states don't have the power to do that.