Weird result when grouping and self-joining a table
It's because your price column is unsigned.

CASTing the values works ok:

SELECT
 ii.invoice_item_id,
 pii.invoice_item_id,
 ii.previous_invoice_item_id,
 cast(ii.price as signed) - cast(pii.price as signed ),
 ii.price,
 pii.price
FROM test ii
JOIN test pii ON pii.invoice_item_id = ii.previous_invoice_item_id
GROUP BY ii.invoice_item_id