On a halachic level, the only issue that comes to mind is dina d'malchusa dina - i.e. we are required to follow secular law.
YYDL also wonders if there is any element of stealing in the act of counting cards.
Let's first address dina d'malchusa.
Counting cards is not illegal, as long as you're not using any device to do it.
However, just like your local 7-11, casinos "reserve the right to refuse service to anyone"
Blackjack dealers generally know how to count cards. They are keeping track of the count on the table. If the count is high, and you suddenly increase your bet tenfold; the dealer, and likely the pit boss, will know what you're doing.
Again, counting cards is not illegal. Any money you win on that big bet hand is yours to keep.
However, once that hand is finished, the pit boss might walk over to you and say something like "I'm sorry Mr. Greenberg, you're just too good for us. We invite you to play our other games, but blackjack is now off limits to you."
That's the best case scenario. The worst case scenario is having security guards escort you off of the premises.
Also, your face will be entered into a computer system that all casinos share. From then on, anytime you enter any subscribing casino, the face recognition software will identify you as a known card counter, and you might not be allowed to even play the first hand.
The above is all regarding the civil legal code and card counting.
Now, to address YYDL's addendum: is card counting a form of stealing?
The original question started with the condition: "assuming that gambling is permitted". Therefore, I will not rehash the halachic arguments for and against gambling in general.
There are many card games in which the player benefits from taking notice of which cards have already been played. The best bridge players, for example, quickly memorize every card played as it laid on the table, to better understand what is left in their opponents' hands.
The card counter does not cheat, alter the rules, or interfere with the physical composition of the cards in any way. He merely keeps track, mentally, of which types of cards have already been removed from the multi-deck shoe.
Since we have already established that card counting is not against the rules, it cannot be considered cheating. Employing the best strategy possible is the proper way to win at a game - therefore I find it difficult to call it a violation of "lo tignov."
Card counting is legal, not a problem of stealing, but the casinos can kick you out for any reason at any time.
Is it worth the potential chillul Hashem (of being escorted out by security) to make a few bucks? Card counting is mutar, but if you're going to do it, be discreet about it.