Unless your account is flagged as a "Day Trader", you can't buy $40,000 of stock with only $10,000 in cash. If your account is flagged as a "Day Trader", you will need a minimum of $25K in order to trade. However, with only $10,000 in cash, you are allowed to take positions up to $20,000. If you close out your entire position before the end of the day that you buy it, you will incur no cost-of borrowing.