I asked this question before to the SMS person when I forced to choose the least expensive fare for my city pairs. I wanted to fly DL, but NW was the low cost; however, they did have a few legs on DL metal as codeshares.
The reason I was told is that NW purchases a specific number of codeshare seats on the DL flight, and they are free to sell those at the price they choose. In effect, the SMS gentleman said something to me like, "why they would want to sell it that inexpensive is beyond me, but if you see that fare online and can get it, book it that way."
I did, flew through ATL to DTW on my way to IAD. A bit longer, but I enjoy MRs anyway, and it cost $170 (about $200 less than DL at the time).