You’re confusing friction with resistance.
You must overcome resistance in order to compress a spring, but the spring doesn’t have friction. (Unless it is being dragged along the ground...)
I see what you’re saying, but it’s pretty difficult to have motion without friction unless you have something moving through a vacuum. If you stretch and compress a spring rapidly, it’s going to get hot. The motion gets converted to heat. There’s a lot of heat in an internal combustion engine and all parts are not going to expand and contract at the same rate, so pretty difficult to reduce the friction of all the moving parts by a significant amount. Parts are lubed with oil to reduce friction and remove heat, but the oil itself even creates some friction. Am I missing something?