Think of it like this: if ever candy is split in 3 we can multiply 8 time 3 to see the total amount of piece that she can give. 8×3=24 which exactly enough for one per each student.
Since 12 cost $27, you can use compatible numbers to make it ~$28. So, then for 6, it would cost $14 because you just halve everything. Is that what you are getting at?