Most credit cards allow you to take "cash advances", but the fees and limits for cash advances are different than for regular purchases. You can buy stock after taking a cash advance from your credit card.
When you make a cash advance, you normally pay the credit card company a fee. When you make a regular purchase, the merchant (ie, the stockbroker) pays a fee. Additionally, credit card companies can make merchants wait up to 3 months to actually receive the money, in case the transaction is disputed.
Your stockbroker is unlikely to want to pay the fee, accept the delay in receiving the funds, and risking that you will dispute the transaction.
Having said that, many FOREX brokers will accept credit card deposits (treated as purchases), although FOREX can be considerably riskier than the stock market.
Of course, if you max out your credit cards and lose all your money, you can normally negotiate to pay back the debt for less than the original amount, especially since it's unsecured debt.