In order to calculate the unit price, we need to divide the price of a bag by the number of pounds of that bag.
So, for the first bag, the price is $11.96 and the weight is 2.24, so the unit price is:

Now, for the second bag ($17.24, 3.12 pounds), we have:

The first bag has a smaller unit price, therefore the better buy is the 2.24-pound bag.