The Court yesterday held in C-238/21 Porr Bau. I reviewed Medina AG’s Opinion here.
The Court notes ia  Austria’s contention that, under Austrian law, where materials are excavated or demolished in the course of a construction project, the main purpose of the construction developer is usually to carry out that project without being hindered by those materials, with the result that they are removed from the site in question with the intention of discarding them. That sentence already holds the key to the eventual judgment in the word ‘usually’.
The Court like, as I noted, the AG, repeatedly refers to Sappi Austria.  following from the various elements considered in Sappi Austria (which itself cross-refers to eg CJEU Shell), the national court is instructed to determine whether the excavated materials constituted a burden which that construction undertaking sought to discard, with the result that there would be a risk that that undertaking would discard them in a manner likely to cause harm to the environment, particularly by dumping them or disposing of them in an uncontrolled manner. :
In the present case, it is apparent from the information before the Court that, even before the excavation of the materials at issue in the main proceedings, local farmers had made an express request for the supply of such materials. After appropriate construction projects had been found, making the requested excavated materials available, that request, it is stated, led to a commitment by Porr Bau to make those excavated materials available, alongside an agreement under which that undertaking would carry out, by means of those materials, the works to adapt and improve the land and cultivation areas duly identified. Such factors, if proven which it is for the referring court to determine, do not appear to be such as to establish the intention of the construction undertaking concerned to discard those materials.
The Court then leaps to an assessment of whether the soil may be considered a by-product under Article 5 WFD, in a logical sequence which I still do not quite get: 
It is, therefore, necessary to examine whether the excavated materials at issue in the main proceedings must be classified as a ‘by-product’ within the meaning of Article 5(1) of Directive 2008/98.
It is the ‘therefore’ which I do not understand. If a party does not ‘discard’ the materials which the Court seems to suggest is the case here, then the ‘waste’ definition is not met. There is then no need to consider whether the materials might be ‘by-products’, for this would mean that if the scenario does not meet with the A5 ‘by-products’ definition, they might nevertheless have to be regarded as waste despite the earlier determination of there not being an element of discarding.
The Court nevertheless assesses all A5 criteria leading it strongly to suggest that these products are indeed by-products. It repeats in my view its fallacy of the waste-by products relationship in the dictum of the judgment:
Point 1 of Article 3 and Article 6(1) of Directive 2008/98/EC of the European Parliament and of the Council of 19 November 2008 on waste and repealing certain Directives,
must be interpreted as precluding national legislation under which uncontaminated excavated materials, which, pursuant to national law, are in the highest quality class,
– must be classified as ‘waste’ where their holder neither intends nor is required to discard them and those materials meet the conditions laid down in Article 5(1) of that directive for being classified as ‘by-products’, and
– only lose that waste status when they are used directly as a substitute and their holder has satisfied the formal criteria which are irrelevant for the purposes of environmental protection, if those criteria have the effect of undermining the attainment of the objectives of that directive.
It also rebukes the Austrian regime from the point of view of end of waste status, dismissing some of the Austrian requirements for a material to be able to reach that status, as irrelevant and counter-productive to the objectives of the WFD. These requirements are said to be “formal criteria (in particular record-keeping and documentation obligations) which have no environmentally relevant influence” however neither the CJEU nor the referring court give any further detail.
This is a first chamber, in a five -judge composition. I don’t think it has definitively solved the relationship between ‘waste’ and ‘by-products’.
EU Waste law, 2nd ed 2015, 1.20 ff.