Three-level analog output (Ground, 2.5V and 5V) - DAC good enough?
Try this circuit:-







simulate this circuit &ndash; Schematic created using CircuitLab

B high (A don't care)- 0V out
B low, A high - 2~3V out
B low, A low - 4~5V out

Since the RPi has 0V/3.3V out, we need to shift the levels up to get 5V out, and 
the transistors are a pretty good way of doing that. R1 (1/4W) makes it short-circuit
proof, R6/R7 establish the voltages, R8 R9 just limit the base current.