Suppose there is a black stone in the corner but it is impossible for black to survive, no matter how well played.
By convention, both sides recognize this and the black stone is counted as a prisoner.
If either side doesn't accept the convention, both sides will alternately play until the situation is resolved (in favour of white).
At that point, black and white will have played the same number of stones each.
White loses a point for each one it played (loss of territory), and white gains a point for each one that black played (taken as prisoner).
There is no net change in the score as compared with accepting the initial situation and neither side playing any more.
Note that the above is based on territory scoring rules, where points are given only for unoccupied territory (and prisoners).
Under area rules the non-prisoner stones on the board are also counted as part of the territory, so any stones played by white into its own territory would not cost white anything.