J&J Snack Foods has booked a jump in first-half earnings, driven by higher sales, lower costs and an increase in investment income.