The answer is the next sentence from the Wikipedia article:
The precise manner in which interest is charged is usually detailed in a cardholder agreement which may be summarized on the back of the monthly statement.
Your previous question on credit card interest rates quotes the sentence after this.
You have to review what the agreement for your card says. Also keep in mind the bank wants to make money from you. The more interest and fees they collect, they better they like you. If enough card holders adjust their behavior, to minimize interest and fees; the bank will then adjust the credit card agreement to get money a different way.
Yes, you are right it would seem fair to only charge interest on the smaller amount, but that doesn't allow the credit card issuer to maximize profits.