So X, Y, and Z must be positive integers. That's important information!

From X+ Y+ Z= 12 and 8X+2Y+Z=48, multiply the first equation by 2 and subtract from the second: 6X- Z= 24. Because X, Y, and Z must be integers, that is what is known as a "Diophantine" equation. Notice that 6(1)- 5= 1. Multiplying by 24, 6(24)- (120)= 24 so X= 24, Z= 120 would work. Unfortunately, that gives Y= 12- X- Z= 12- 24- 120= -132.

However If X and Z are any solution to 6X- Z= 24, so is X+ n, Z+ 6n for n any integer because 6(X+ n)- (Z+6n)= 6X- Z+ 6n- 6n= 6X- Z= 24. If we put 24+ n and 120+ 6n into the equation Y= 12- X- Z we get Y= 12- 24- n+ -120- 6n= -132- 7n. That will be larger than 0 when Y= -132- 7n> 0 or -7n> -132, n< -132/7= -18.8. If we take n= -19 we get X= 24-19= 5, Z= 120- 114= 6 and Y= 12- 5- 6= 1.

If we take n to be any number larger than -19 we get Y negative. If we take n= -20, X= 24- 20= 4, Z= 120- 120= 0, and Y= 12- 4= 8.

If you must have purchased at least on of every fruit, you must have purchased 5 apples, 1 orange and 6 peaches.

If it is not required that you purchased at least one of every fruit, 4 apples and 8 oranges would also work.
Why in the world are apples so much more expensive than peaches?