Here is my itinerary, followed by my question:
X (a European city) --> New York, JFK New York, JFK --> Y (a South American city)
Do I need to pass through the passport control at JFK if I purchase those two flights separately?
There are no transit areas in US airports. Pathways through US immigration are the same regardless of whether you are leaving the airport immediately afterwards, taking a domestic connection, or taking an international connection. Thus, you need to have appropriate documentation to enter the US for whatever is your intended purpose (in your case, transit).