Should the desire to go back to one's country after graduation be written in the statement of purpose?
Depending on your wording (and to a lesser extent on your discipline), I do not think this is problematic at all. Most public universities in the US are not directly concerned with the monetary investment in their students.

Rather, they are concerned with attracting motivated, high-quality graduate students along with an undergraduate student body that contains (and serves) many students from the state but also includes students from diverse backgrounds and with different life experiences.

You do not say in your question whether you are pursuing a graduate or undergraduate degree, but I think in either case it's fine. Having a plan to return to your home country is totally understandable, and speaks to both your motivation and long-term planning.

Furthermore, admissions committees understand that while you have this plan now, that things can happen over the course of years and that you plans you outline in your statement of purpose may change.

As multiple comments and answers indicate, this should not be the main focus of your statement of purpose and does not need to be belabored.

I agree with the comment that "patriotism" is not quite the right word for your preferences, and I think using that word (or some others) would seem strange or inappropriate in your statement, but in general, expressing a desire to eventually apply the skills you will be learning in your home country should not be a problem.