Suppose I can sell a European put in two ways: 1) in a mark to market collateralized market with collateral rate equal to the riskless rate $r$; 2) in a noncollaterized market where I get the payment for the put up front $0$ and invest in either a risky market account or a risky (defaultable) bond at rate $r+\lambda$.
1) I think the European put price is
$$P_1(t) = \mathbf E\big[e^{-\int_t^T r\,ds}\big(K-S(T)\big)_+\big|\mathcal F_t\big].$$
2) I am of two minds. On the one hand, a riskless instantaneous portfolio could be formed by the put with price $P_2(t)$ and the stock with price $S(t)$, with the portfolio price being $P_2(t)-\frac{\partial P_2(t)}{\partial S}S(t)$, as in the usual Black-Scholes argument. Then the growth rate of this riskless portfolio should be just the riskless rate $r$ and we should just have the same price as in 1). On the other hand, the default probability of the risky bond/money market should impose the credit spread $\lambda$ on the interest rate, so the put price should be $$P_2(t) = \mathbf E\big[e^{-\int_t^T (r+\lambda)\,ds}\big(K-S(T)\big)_+\big|\mathcal F_t\big]$$
Which is the correct discount factor? If neither is true, what is the correct answer?