Yes you can. But there are several considerations. Generally hooking keyboards together like this, only allows the second keyboard access to the sounds, that are currently loaded up for the Master keyboard. If your Master keyboard allows you to assign different key zones (regions of the actual keyboard), you can have one keyboard play those sounds, and transpose the other keyboard down to play another zone in the current program. Alternatively, if the Master keyboard has a multi-channel sequencer (Most mid-to-high-spec workstations), you could set up a variety of sounds to play from the Global MIDI channel (The MIDI channel your master board transmits), and another variety of sounds to play when triggered from another MIDI channel (The channel the Slave keyboard transmits on).
In either case, the primary concern is the polyphonic limits of the master keyboard.
I.E. Say your Master keyboard has 64 voice polyphony, and you load up a program that has 8 layers using 2 voices each. Every keystroke = 16 voices. So basically you can press 4 simultaneous keys (64 voices). How a keyboard deals with it's polyphony allocation varies by make and model, but traditionally after the polyphonic limit is exceeded the keyboard ceases to play notes in the order they were played. So you can see, if you played 4 keys right close together and continued to press additional keys, the keyboard would first stop playing notes from the first key, when you press the fifth key, the second note is released when you press the sixth key. Of course if the program uses less voices then you are allowed more simultaneous notes.
So now as an example you set the Master keyboard up with the same 8 layer (x2 voice) program, and a second 8 layer (x2 voice) program set up for the Slave keyboard, you have effectively reduced the Master keyboard's sound module, to only being able to play 2 notes simultaneously, not very handy if you want to have a sustained string patch playing chords, while trying to play a multi-layer piano sound.
One final consideration is MIDI itself. Some (actually most) keyboards I have tried this with, often have trouble processing MIDI data when under an extreme load. You may end up with stuck notes, which are usually only cured by changing the program (or not cured at all if the stuck MIDI data is originating in the Slave board), and VERY RARELY, will you find MIDI Panic buttons on synthesizers (Those that do are going to cost big $$$).
But if you invest in a higher-spec keyboard, and are careful to budget your processing power, what you suggest is a viable solution. But you're still adding a second keyboard (via the controller), so why not just get one that has its own sounds, features, and character. Hope this helps clarify this subject a bit.
And if you think having 2 keyboards is outrageous, you need to look at some of the classic rigs out there (Keith Emerson's, Richard Tandy's, etc.), especially pre-MIDI rigs. Some of those great 70's keyboardists were using a half-dozen or more of classic analog syths combined with B3's and Leslies speakers, and REAL acoustic pianos. I drool with jealousy!!! But not because they needed an entire moving van just for keyboards.