An imp-in-a-box is made by catching an imp with a magic box. It can be used by right-clicking on it and choosing "Bank Imp-in-a-box"; then, a window will come up where the items to be sent to the bank can be selected (be careful to not click twice quickly, because items can move after clicking on the first one). Alternatively, simply use an item on the box for it to be sent to your bank. This method is a quick way for players with higher Hunter levels (71 required to catch imps) to quickly bank items in, for example, PvP areas. The imp will agree to take two items or stacks from the player to the bank in exchange for its freedom; however, it will refuse to do so past level 30 Wilderness. Tele Block will also prevent banking with the box.
Note that while the box can be used to send two items to the bank, it will be labelled Imp-in-a-box (2); when one has already been used, it will be labelled Imp-in-a-box (1) and when both have been used, it will revert to magic box.
When collecting valuable items, one tactic is to just drop the magic box once the banking of the imp-in-a-box has been used up, as the profit from the items can greatly exceed the cost of the box. For example, red dragons drop dragon bones and red dragonhide, each of which is worth several thousands of coins per item. It thus can make sense to drop the magic boxes when emptied, in order to carry more bones and dragonhides.