In these cases, a commercial bank from the second level of the banking system creates money. However, the costumer might be a commercial bank as well, in this case, it is the central bank who creates money. Out of the three methods of money creation, buying foreign exchange and buying securities are secondary.