In price line and matrix estimation, codes are assigned to production components based on factors such as size, complexity, and other variables involved in the printing process. This method helps streamline the estimating process and categorize production components for efficient pricing.