Possibly because other auto manufacturers do include R&D in their COGS? Tesla, instead, treats it as an OpEx which to be fair, most non-automotive companies do as well. Still, it's not standard for the industry the are in.
tldr: Because if Tesla did their accounting the way Toyota does, they have a negative gross margin.