The cost of defects identified during Software Testing, completely depends on the impact of the defects found. The earlier the defect is found, easier and less costly it is to fix these defects. For instance, if there is a defect found in the project requirement specifications and analysis, then it is relatively cheaper to fix it.
Similarly, if the defects or failures are found in the design of the software, then the product design is corrected and then re-issued. However, if these defects somehow get missed by testers and if they are identified during the user acceptance phase, then it can be way too expensive to fix such type of errors.
If during the software development process, an error is made and the consequent defect is detected in the requirements phase itself, then it is relatively cheaper to fix it. This is because the software is not yet in developing stage and it is easy to make requirement specified changes.
However, if an error is made during the requirement phase and goes undetected until it is found during the designing phase, then it can be a little bit expensive to fix this error. In this case, the error is made in the requirement phase. Now, the software is designed according to these faulty requirements. Hence, when the error is found, it becomes a little expensive to revert back the mistakes done in the requirement phase.
Now the same concept can be applied to understand why it is highly costly to fix defects found in the construction phase. Consider an error made in developing phase and the consequent defect is not found until the acceptance testing is done or even till the time when the system has been first implemented. In that case, it will be very expensive to redo the entire work to match the specifications and design needed. Moreover, this one defect may very well propagate to other parts of code and design for which testing is done again to reach the point of confidence in the software quality. .
Sometimes, it may also happen that the defects that are detected at a very late stage are not even corrected because the cost of fixing that defect is very high. This greatly depends on how serious the defect detected is.