Yes. There is no rule against foreigners buying a car in Italy. What you need depends on the seller:
- From a dealer: passport and usually an Italian tax code (codice fiscale), which the dealer needs for the invoice and the paperwork. Non-residents can request a codice fiscale from the Italian tax agency or an Italian consulate.
- From a private seller: the ownership transfer (passaggio di proprietà) is done at the PRA/ACI office or a licensed vehicle agency (agenzia pratiche auto) and also needs your codice fiscale.
The real obstacle comes next: registering a car in your name in Italy requires Italian residency. That is why most non-residents register the car in another EU country.